Rename HTTPRequest.uri -> path
Replace strings with None for default value Fix HTTP Header parsing Fix one spot where we're still parsing XML incorrectly
This commit is contained in:
Родитель
157e0063ce
Коммит
4362bdce74
|
@ -404,10 +404,10 @@ def _update_request_uri_query(request):
|
|||
query parameters on the request the parameters in the URI will
|
||||
appear after the existing parameters'''
|
||||
|
||||
if '?' in request.uri:
|
||||
pos = request.uri.find('?')
|
||||
query_string = request.uri[pos+1:]
|
||||
request.uri = request.uri[:pos]
|
||||
if '?' in request.path:
|
||||
pos = request.path.find('?')
|
||||
query_string = request.path[pos+1:]
|
||||
request.path = request.path[:pos]
|
||||
if query_string:
|
||||
query_params = query_string.split('&')
|
||||
for query in query_params:
|
||||
|
@ -417,17 +417,17 @@ def _update_request_uri_query(request):
|
|||
value = query[pos+1:]
|
||||
request.query.append((name, value))
|
||||
|
||||
request.uri = urllib2.quote(request.uri, '/()$=\',')
|
||||
request.path = urllib2.quote(request.path, '/()$=\',')
|
||||
|
||||
#add encoded queries to request.uri.
|
||||
#add encoded queries to request.path.
|
||||
if request.query:
|
||||
request.uri += '?'
|
||||
request.path += '?'
|
||||
for name, value in request.query:
|
||||
if value is not None:
|
||||
request.uri += name + '=' + urllib2.quote(value, '/()$=\',') + '&'
|
||||
request.uri = request.uri[:-1]
|
||||
request.path += name + '=' + urllib2.quote(value, '/()$=\',') + '&'
|
||||
request.path = request.path[:-1]
|
||||
|
||||
return request.uri, request.query
|
||||
return request.path, request.query
|
||||
|
||||
def _dont_fail_on_exist(error):
|
||||
''' don't throw exception if the resource exists. This is called by create_* APIs with fail_on_exist=False'''
|
||||
|
|
|
@ -48,7 +48,7 @@ class HTTPRequest:
|
|||
|
||||
host: the host name to connect to
|
||||
method: the method to use to connect (string such as GET, POST, PUT, etc...)
|
||||
uri: the uri fragment
|
||||
path: the uri fragment
|
||||
query: query parameters specified as a list of (name, value) pairs
|
||||
headers: header values specified as (name, value) pairs
|
||||
body: the body of the request.
|
||||
|
@ -57,7 +57,7 @@ class HTTPRequest:
|
|||
def __init__(self):
|
||||
self.host = ''
|
||||
self.method = ''
|
||||
self.uri = ''
|
||||
self.path = ''
|
||||
self.query = [] # list of (name, value)
|
||||
self.headers = [] # list of (header name, header value)
|
||||
self.body = ''
|
||||
|
|
|
@ -43,15 +43,15 @@ class _BatchClient(_HTTPClient):
|
|||
|
||||
request: the request to insert, update or delete entity
|
||||
'''
|
||||
if '(' in request.uri:
|
||||
pos = request.uri.find('(')
|
||||
return request.uri[1:pos]
|
||||
if '(' in request.path:
|
||||
pos = request.path.find('(')
|
||||
return request.path[1:pos]
|
||||
else:
|
||||
return request.uri[1:]
|
||||
return request.path[1:]
|
||||
|
||||
def get_request_partition_key(self, request):
|
||||
'''
|
||||
Extracts PartitionKey from request.body if it is a POST request or from request.uri if
|
||||
Extracts PartitionKey from request.body if it is a POST request or from request.path if
|
||||
it is not a POST request. Only insert operation request is a POST request and the
|
||||
PartitionKey is in the request body.
|
||||
|
||||
|
@ -64,7 +64,7 @@ class _BatchClient(_HTTPClient):
|
|||
raise WindowsAzureError(azure._ERROR_CANNOT_FIND_PARTITION_KEY)
|
||||
return part_key[0].firstChild.nodeValue
|
||||
else:
|
||||
uri = urllib2.unquote(request.uri)
|
||||
uri = urllib2.unquote(request.path)
|
||||
pos1 = uri.find('PartitionKey=\'')
|
||||
pos2 = uri.find('\',', pos1)
|
||||
if pos1 == -1 or pos2 == -1:
|
||||
|
@ -73,20 +73,20 @@ class _BatchClient(_HTTPClient):
|
|||
|
||||
def get_request_row_key(self, request):
|
||||
'''
|
||||
Extracts RowKey from request.body if it is a POST request or from request.uri if
|
||||
Extracts RowKey from request.body if it is a POST request or from request.path if
|
||||
it is not a POST request. Only insert operation request is a POST request and the
|
||||
Rowkey is in the request body.
|
||||
|
||||
request: the request to insert, update or delete entity
|
||||
'''
|
||||
if request.method == 'POST':
|
||||
pos1 = request.body.find('<d:RowKey>')
|
||||
pos2 = request.body.find('</d:RowKey>')
|
||||
if pos1 == -1 or pos2 == -1:
|
||||
doc = minidom.parseString(request.body)
|
||||
row_key = _get_children_from_path(doc, 'entry', 'content', (METADATA_NS, 'properties'), (_DATASERVICES_NS, 'RowKey'))
|
||||
if not row_key:
|
||||
raise WindowsAzureError(azure._ERROR_CANNOT_FIND_ROW_KEY)
|
||||
return request.body[pos1 + len('<d:RowKey>'):pos2]
|
||||
return row_key[0].firstChild.nodeValue
|
||||
else:
|
||||
uri = urllib2.unquote(request.uri)
|
||||
uri = urllib2.unquote(request.path)
|
||||
pos1 = uri.find('RowKey=\'')
|
||||
pos2 = uri.find('\')', pos1)
|
||||
if pos1 == -1 or pos2 == -1:
|
||||
|
@ -177,7 +177,7 @@ class _BatchClient(_HTTPClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'POST'
|
||||
request.host = self.batch_requests[0].host
|
||||
request.uri = '/$batch'
|
||||
request.path = '/$batch'
|
||||
request.headers = [('Content-Type', 'multipart/mixed; boundary=' + batch_boundary),
|
||||
('Accept', 'application/atom+xml,application/xml'),
|
||||
('Accept-Charset', 'UTF-8')]
|
||||
|
@ -193,7 +193,7 @@ class _BatchClient(_HTTPClient):
|
|||
request.body += 'Content-Type: application/http\n'
|
||||
request.body += 'Content-Transfer-Encoding: binary\n\n'
|
||||
|
||||
request.body += batch_request.method + ' http://' + batch_request.host + batch_request.uri + ' HTTP/1.1\n'
|
||||
request.body += batch_request.method + ' http://' + batch_request.host + batch_request.path + ' HTTP/1.1\n'
|
||||
request.body += 'Content-ID: ' + str(content_id) + '\n'
|
||||
content_id += 1
|
||||
|
||||
|
@ -215,7 +215,7 @@ class _BatchClient(_HTTPClient):
|
|||
request.body += '--' + changeset_boundary + '--' + '\n'
|
||||
request.body += '--' + batch_boundary + '--'
|
||||
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_storage_table_header(request)
|
||||
auth = _sign_storage_table_request(request,
|
||||
self.account_name,
|
||||
|
|
|
@ -86,7 +86,7 @@ class _HTTPClient:
|
|||
''' Sends request to cloud service server and return the response. '''
|
||||
|
||||
connection = self.get_connection(request)
|
||||
connection.putrequest(request.method, request.uri)
|
||||
connection.putrequest(request.method, request.path)
|
||||
self.send_request_headers(connection, request.headers)
|
||||
self.send_request_body(connection, request.body)
|
||||
|
||||
|
|
|
@ -318,8 +318,15 @@ class _HTTPConnection:
|
|||
status_text = self._httprequest.status_text()
|
||||
|
||||
resp_headers = self._httprequest.get_all_response_headers()
|
||||
headers = []
|
||||
fixed_headers = []
|
||||
for resp_header in resp_headers.split('\n'):
|
||||
if resp_header.startswith('\t') or resp_header.startswith(' ') and headers:
|
||||
fixed_headers[-1] += resp_header
|
||||
else:
|
||||
fixed_headers.append(resp_header)
|
||||
|
||||
headers = []
|
||||
for resp_header in fixed_headers:
|
||||
if ':' in resp_header:
|
||||
pos = resp_header.find(':')
|
||||
headers.append((resp_header[:pos], resp_header[pos+1:].strip()))
|
||||
|
|
|
@ -48,42 +48,42 @@ class Queue(WindowsAzureData):
|
|||
''' Queue class corresponding to Queue Description: http://msdn.microsoft.com/en-us/library/windowsazure/hh780773'''
|
||||
|
||||
def __init__(self):
|
||||
self.lock_duration = ''
|
||||
self.max_size_in_megabytes = ''
|
||||
self.duplicate_detection = ''
|
||||
self.requires_duplicate_detection = ''
|
||||
self.requires_session = ''
|
||||
self.default_message_time_to_live = ''
|
||||
self.enable_dead_lettering_on_message_expiration = ''
|
||||
self.duplicate_detection_history_time_window = ''
|
||||
self.max_delivery_count = ''
|
||||
self.enable_batched_operations = ''
|
||||
self.size_in_bytes = ''
|
||||
self.message_count = ''
|
||||
self.lock_duration = None
|
||||
self.max_size_in_megabytes = None
|
||||
self.duplicate_detection = None
|
||||
self.requires_duplicate_detection = None
|
||||
self.requires_session = None
|
||||
self.default_message_time_to_live = None
|
||||
self.enable_dead_lettering_on_message_expiration = None
|
||||
self.duplicate_detection_history_time_window = None
|
||||
self.max_delivery_count = None
|
||||
self.enable_batched_operations = None
|
||||
self.size_in_bytes = None
|
||||
self.message_count = None
|
||||
|
||||
class Topic(WindowsAzureData):
|
||||
''' Topic class corresponding to Topic Description: http://msdn.microsoft.com/en-us/library/windowsazure/hh780749. '''
|
||||
|
||||
def __init__(self):
|
||||
self.default_message_time_to_live = ''
|
||||
self.max_size_in_mega_bytes = ''
|
||||
self.requires_duplicate_detection = ''
|
||||
self.duplicate_detection_history_time_window = ''
|
||||
self.enable_batched_operations = ''
|
||||
self.size_in_bytes = ''
|
||||
self.default_message_time_to_live = None
|
||||
self.max_size_in_mega_bytes = None
|
||||
self.requires_duplicate_detection = None
|
||||
self.duplicate_detection_history_time_window = None
|
||||
self.enable_batched_operations = None
|
||||
self.size_in_bytes = None
|
||||
|
||||
class Subscription(WindowsAzureData):
|
||||
''' Subscription class corresponding to Subscription Description: http://msdn.microsoft.com/en-us/library/windowsazure/hh780763. '''
|
||||
|
||||
def __init__(self):
|
||||
self.lock_duration = ''
|
||||
self.requires_session = ''
|
||||
self.default_message_time_to_live = ''
|
||||
self.dead_lettering_on_message_expiration = ''
|
||||
self.dead_lettering_on_filter_evaluation_exceptions = ''
|
||||
self.enable_batched_operations = ''
|
||||
self.max_delivery_count = ''
|
||||
self.message_count = ''
|
||||
self.lock_duration = None
|
||||
self.requires_session = None
|
||||
self.default_message_time_to_live = None
|
||||
self.dead_lettering_on_message_expiration = None
|
||||
self.dead_lettering_on_filter_evaluation_exceptions = None
|
||||
self.enable_batched_operations = None
|
||||
self.max_delivery_count = None
|
||||
self.message_count = None
|
||||
|
||||
class Rule(WindowsAzureData):
|
||||
''' Rule class corresponding to Rule Description: http://msdn.microsoft.com/en-us/library/windowsazure/hh780753. '''
|
||||
|
@ -209,7 +209,7 @@ def _get_token(request, account_key, issuer):
|
|||
account_key: service bus access key
|
||||
issuer: service bus issuer
|
||||
'''
|
||||
wrap_scope = 'http://' + request.host + request.uri
|
||||
wrap_scope = 'http://' + request.host + request.path
|
||||
|
||||
# Check whether has unexpired cache, return cached token if it is still usable.
|
||||
if _tokens.has_key(wrap_scope):
|
||||
|
@ -220,7 +220,7 @@ def _get_token(request, account_key, issuer):
|
|||
#get token from accessconstrol server
|
||||
request_body = ('wrap_name=' + urllib2.quote(issuer) + '&wrap_password=' +
|
||||
urllib2.quote(account_key) + '&wrap_scope=' +
|
||||
urllib2.quote('http://' + request.host + request.uri))
|
||||
urllib2.quote('http://' + request.host + request.path))
|
||||
host = request.host.replace('.servicebus.', '-sb.accesscontrol.')
|
||||
if sys.platform.lower().startswith('win'):
|
||||
import azure.http.winhttp
|
||||
|
@ -453,21 +453,21 @@ def convert_subscription_to_xml(subscription):
|
|||
|
||||
subscription_body = '<SubscriptionDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">'
|
||||
if subscription:
|
||||
if subscription.lock_duration:
|
||||
if subscription.lock_duration is not None:
|
||||
subscription_body += ''.join(['<LockDuration>', subscription.lock_duration, '</LockDuration>'])
|
||||
if subscription.requires_session:
|
||||
if subscription.requires_session is not None:
|
||||
subscription_body += ''.join(['<RequiresSession>', subscription.requires_session, '</RequiresSession>'])
|
||||
if subscription.default_message_time_to_live:
|
||||
if subscription.default_message_time_to_live is not None:
|
||||
subscription_body += ''.join(['<DefaultMessageTimeToLive>', subscription.default_message_time_to_live, '</DefaultMessageTimeToLive>'])
|
||||
if subscription.dead_lettering_on_message_expiration:
|
||||
if subscription.dead_lettering_on_message_expiration is not None:
|
||||
subscription_body += ''.join(['<DeadLetteringOnMessageExpiration>', subscription.dead_lettering_on_message_expiration, '</DeadLetteringOnMessageExpiration>'])
|
||||
if subscription.dead_lettering_on_filter_evaluation_exceptions:
|
||||
if subscription.dead_lettering_on_filter_evaluation_exceptions is not None:
|
||||
subscription_body += ''.join(['<DeadLetteringOnFilterEvaluationExceptions>', subscription.dead_lettering_on_filter_evaluation_exceptions, '</DeadLetteringOnFilterEvaluationExceptions>'])
|
||||
if subscription.enable_batched_operations:
|
||||
if subscription.enable_batched_operations is not None:
|
||||
subscription_body += ''.join(['<EnableBatchedOperations>', subscription.enable_batched_operations, '</EnableBatchedOperations>'])
|
||||
if subscription.max_delivery_count:
|
||||
if subscription.max_delivery_count is not None:
|
||||
subscription_body += ''.join(['<MaxDeliveryCount>', subscription.max_delivery_count, '</MaxDeliveryCount>'])
|
||||
if subscription.message_count:
|
||||
if subscription.message_count is not None:
|
||||
subscription_body += ''.join(['<MessageCount>', subscription.message_count, '</MessageCount>'])
|
||||
|
||||
subscription_body += '</SubscriptionDescription>'
|
||||
|
@ -509,18 +509,18 @@ def convert_topic_to_xml(topic):
|
|||
|
||||
topic_body = '<TopicDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">'
|
||||
if topic:
|
||||
if topic.default_message_time_to_live:
|
||||
topic_body += ''.join(['<DefaultMessageTimeToLive>', topic.default_message_time_to_live, '</DefaultMessageTimeToLive>'])
|
||||
if topic.max_size_in_mega_bytes:
|
||||
topic_body += ''.join(['<MaxSizeInMegabytes>', topic.default_message_time_to_live, '</MaxSizeInMegabytes>'])
|
||||
if topic.requires_duplicate_detection:
|
||||
topic_body += ''.join(['<RequiresDuplicateDetection>', topic.default_message_time_to_live, '</RequiresDuplicateDetection>'])
|
||||
if topic.duplicate_detection_history_time_window:
|
||||
topic_body += ''.join(['<DuplicateDetectionHistoryTimeWindow>', topic.default_message_time_to_live, '</DuplicateDetectionHistoryTimeWindow>'])
|
||||
if topic.enable_batched_operations:
|
||||
topic_body += ''.join(['<EnableBatchedOperations>', topic.default_message_time_to_live, '</EnableBatchedOperations>'])
|
||||
if topic.size_in_bytes:
|
||||
topic_body += ''.join(['<SizeinBytes>', topic.default_message_time_to_live, '</SizeinBytes>'])
|
||||
if topic.default_message_time_to_live is not None:
|
||||
topic_body += ''.join(['<DefaultMessageTimeToLive>', str(topic.default_message_time_to_live), '</DefaultMessageTimeToLive>'])
|
||||
if topic.max_size_in_mega_bytes is not None:
|
||||
topic_body += ''.join(['<MaxSizeInMegabytes>', str(topic.default_message_time_to_live), '</MaxSizeInMegabytes>'])
|
||||
if topic.requires_duplicate_detection is not None:
|
||||
topic_body += ''.join(['<RequiresDuplicateDetection>', str(topic.default_message_time_to_live), '</RequiresDuplicateDetection>'])
|
||||
if topic.duplicate_detection_history_time_window is not None:
|
||||
topic_body += ''.join(['<DuplicateDetectionHistoryTimeWindow>', str(topic.default_message_time_to_live), '</DuplicateDetectionHistoryTimeWindow>'])
|
||||
if topic.enable_batched_operations is not None:
|
||||
topic_body += ''.join(['<EnableBatchedOperations>', str(topic.default_message_time_to_live), '</EnableBatchedOperations>'])
|
||||
if topic.size_in_bytes is not None:
|
||||
topic_body += ''.join(['<SizeinBytes>', str(topic.default_message_time_to_live), '</SizeinBytes>'])
|
||||
topic_body += '</TopicDescription>'
|
||||
|
||||
return _create_entry(topic_body)
|
||||
|
@ -535,27 +535,27 @@ def convert_queue_to_xml(queue):
|
|||
queue_body = '<QueueDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">'
|
||||
if queue:
|
||||
if queue.lock_duration:
|
||||
queue_body += ''.join(['<LockDuration>', queue.lock_duration, '</LockDuration>'])
|
||||
if queue.max_size_in_megabytes:
|
||||
queue_body += ''.join(['<MaxSizeInMegabytes>', queue.max_size_in_megabytes, '</MaxSizeInMegabytes>'])
|
||||
if queue.requires_duplicate_detection:
|
||||
queue_body += ''.join(['<RequiresDuplicateDetection>', queue.requires_duplicate_detection, '</RequiresDuplicateDetection>'])
|
||||
if queue.requires_session:
|
||||
queue_body += ''.join(['<RequiresSession>', queue.requires_session, '</RequiresSession>'])
|
||||
if queue.default_message_time_to_live:
|
||||
queue_body += ''.join(['<DefaultMessageTimeToLive>', queue.default_message_time_to_live, '</DefaultMessageTimeToLive>'])
|
||||
if queue.enable_dead_lettering_on_message_expiration:
|
||||
queue_body += ''.join(['<EnableDeadLetteringOnMessageExpiration>', queue.enable_dead_lettering_on_message_expiration, '</EnableDeadLetteringOnMessageExpiration>'])
|
||||
if queue.duplicate_detection_history_time_window:
|
||||
queue_body += ''.join(['<DuplicateDetectionHistoryTimeWindow>', queue.duplicate_detection_history_time_window, '</DuplicateDetectionHistoryTimeWindow>'])
|
||||
if queue.max_delivery_count:
|
||||
queue_body += ''.join(['<MaxDeliveryCount>', queue.max_delivery_count, '</MaxDeliveryCount>'])
|
||||
if queue.enable_batched_operations:
|
||||
queue_body += ''.join(['<EnableBatchedOperations>', queue.enable_batched_operations, '</EnableBatchedOperations>'])
|
||||
if queue.size_in_bytes:
|
||||
queue_body += ''.join(['<SizeinBytes>', queue.size_in_bytes, '</SizeinBytes>'])
|
||||
if queue.message_count:
|
||||
queue_body += ''.join(['<MessageCount>', queue.message_count, '</MessageCount>'])
|
||||
queue_body += ''.join(['<LockDuration>', str(queue.lock_duration), '</LockDuration>'])
|
||||
if queue.max_size_in_megabytes is not None:
|
||||
queue_body += ''.join(['<MaxSizeInMegabytes>', str(queue.max_size_in_megabytes), '</MaxSizeInMegabytes>'])
|
||||
if queue.requires_duplicate_detection is not None:
|
||||
queue_body += ''.join(['<RequiresDuplicateDetection>', str(queue.requires_duplicate_detection), '</RequiresDuplicateDetection>'])
|
||||
if queue.requires_session is not None:
|
||||
queue_body += ''.join(['<RequiresSession>', str(queue.requires_session), '</RequiresSession>'])
|
||||
if queue.default_message_time_to_live is not None:
|
||||
queue_body += ''.join(['<DefaultMessageTimeToLive>', str(queue.default_message_time_to_live), '</DefaultMessageTimeToLive>'])
|
||||
if queue.enable_dead_lettering_on_message_expiration is not None:
|
||||
queue_body += ''.join(['<EnableDeadLetteringOnMessageExpiration>', str(queue.enable_dead_lettering_on_message_expiration), '</EnableDeadLetteringOnMessageExpiration>'])
|
||||
if queue.duplicate_detection_history_time_window is not None:
|
||||
queue_body += ''.join(['<DuplicateDetectionHistoryTimeWindow>', str(queue.duplicate_detection_history_time_window), '</DuplicateDetectionHistoryTimeWindow>'])
|
||||
if queue.max_delivery_count is not None:
|
||||
queue_body += ''.join(['<MaxDeliveryCount>', str(queue.max_delivery_count), '</MaxDeliveryCount>'])
|
||||
if queue.enable_batched_operations is not None:
|
||||
queue_body += ''.join(['<EnableBatchedOperations>', str(queue.enable_batched_operations), '</EnableBatchedOperations>'])
|
||||
if queue.size_in_bytes is not None:
|
||||
queue_body += ''.join(['<SizeinBytes>', str(queue.size_in_bytes), '</SizeinBytes>'])
|
||||
if queue.message_count is not None:
|
||||
queue_body += ''.join(['<MessageCount>', str(queue.message_count), '</MessageCount>'])
|
||||
|
||||
queue_body += '</QueueDescription>'
|
||||
return _create_entry(queue_body)
|
||||
|
|
|
@ -53,9 +53,9 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(queue_name) + ''
|
||||
request.path = '/' + str(queue_name) + ''
|
||||
request.body = _get_request_body(convert_queue_to_xml(queue))
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
if not fail_on_exist:
|
||||
try:
|
||||
|
@ -79,8 +79,8 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'DELETE'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(queue_name) + ''
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path = '/' + str(queue_name) + ''
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
if not fail_not_exist:
|
||||
try:
|
||||
|
@ -103,8 +103,8 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(queue_name) + ''
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path = '/' + str(queue_name) + ''
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -117,8 +117,8 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/$Resources/Queues'
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path = '/$Resources/Queues'
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -136,9 +136,9 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(topic_name) + ''
|
||||
request.path = '/' + str(topic_name) + ''
|
||||
request.body = _get_request_body(convert_topic_to_xml(topic))
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
if not fail_on_exist:
|
||||
try:
|
||||
|
@ -163,8 +163,8 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'DELETE'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(topic_name) + ''
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path = '/' + str(topic_name) + ''
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
if not fail_not_exist:
|
||||
try:
|
||||
|
@ -187,8 +187,8 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(topic_name) + ''
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path = '/' + str(topic_name) + ''
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -201,8 +201,8 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/$Resources/Topics'
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path = '/$Resources/Topics'
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -223,9 +223,9 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '/rules/' + str(rule_name) + ''
|
||||
request.path = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '/rules/' + str(rule_name) + ''
|
||||
request.body = _get_request_body(convert_rule_to_xml(rule))
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
if not fail_on_exist:
|
||||
try:
|
||||
|
@ -254,8 +254,8 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'DELETE'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '/rules/' + str(rule_name) + ''
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '/rules/' + str(rule_name) + ''
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
if not fail_not_exist:
|
||||
try:
|
||||
|
@ -282,8 +282,8 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '/rules/' + str(rule_name) + ''
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '/rules/' + str(rule_name) + ''
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -301,8 +301,8 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '/rules/'
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '/rules/'
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -322,9 +322,9 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + ''
|
||||
request.path = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + ''
|
||||
request.body = _get_request_body(convert_subscription_to_xml(subscription))
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
if not fail_on_exist:
|
||||
try:
|
||||
|
@ -350,8 +350,8 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'DELETE'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + ''
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + ''
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
if not fail_not_exist:
|
||||
try:
|
||||
|
@ -376,8 +376,8 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + ''
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + ''
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -393,8 +393,8 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(topic_name) + '/subscriptions/'
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path = '/' + str(topic_name) + '/subscriptions/'
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -414,10 +414,10 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'POST'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(topic_name) + '/messages'
|
||||
request.path = '/' + str(topic_name) + '/messages'
|
||||
request.headers = message.add_headers(request)
|
||||
request.body = _get_request_body(message.body)
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -442,9 +442,9 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'POST'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '/messages/head'
|
||||
request.path = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '/messages/head'
|
||||
request.query = [('timeout', _int_or_none(timeout))]
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -471,8 +471,8 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '/messages/' + str(sequence_number) + '/' + str(lock_token) + ''
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '/messages/' + str(sequence_number) + '/' + str(lock_token) + ''
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -491,9 +491,9 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'DELETE'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '/messages/head'
|
||||
request.path = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '/messages/head'
|
||||
request.query = [('timeout', _int_or_none(timeout))]
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -519,8 +519,8 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'DELETE'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '/messages/' + str(sequence_number) + '/' + str(lock_token) + ''
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path = '/' + str(topic_name) + '/subscriptions/' + str(subscription_name) + '/messages/' + str(sequence_number) + '/' + str(lock_token) + ''
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -538,10 +538,10 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'POST'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(queue_name) + '/messages'
|
||||
request.path = '/' + str(queue_name) + '/messages'
|
||||
request.headers = message.add_headers(request)
|
||||
request.body = _get_request_body(message.body)
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -563,9 +563,9 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'POST'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(queue_name) + '/messages/head'
|
||||
request.path = '/' + str(queue_name) + '/messages/head'
|
||||
request.query = [('timeout', _int_or_none(timeout))]
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -590,8 +590,8 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(queue_name) + '/messages/' + str(sequence_number) + '/' + str(lock_token) + ''
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path = '/' + str(queue_name) + '/messages/' + str(sequence_number) + '/' + str(lock_token) + ''
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -608,9 +608,9 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'DELETE'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(queue_name) + '/messages/head'
|
||||
request.path = '/' + str(queue_name) + '/messages/head'
|
||||
request.query = [('timeout', _int_or_none(timeout))]
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -634,8 +634,8 @@ class ServiceBusService:
|
|||
request = HTTPRequest()
|
||||
request.method = 'DELETE'
|
||||
request.host = self.service_namespace + SERVICE_BUS_HOST_BASE
|
||||
request.uri = '/' + str(queue_name) + '/messages/' + str(sequence_number) + '/' + str(lock_token) + ''
|
||||
request.uri, request.query = _update_request_uri_query(request)
|
||||
request.path = '/' + str(queue_name) + '/messages/' + str(sequence_number) + '/' + str(lock_token) + ''
|
||||
request.path, request.query = _update_request_uri_query(request)
|
||||
request.headers = _update_service_bus_header(request, self.account_key, self.issuer)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
|
|
@ -354,7 +354,7 @@ def _sign_storage_blob_request(request, account_name, account_key):
|
|||
This is also used to sign queue request.
|
||||
'''
|
||||
|
||||
uri_path = request.uri.split('?')[0]
|
||||
uri_path = request.path.split('?')[0]
|
||||
|
||||
#method to sign
|
||||
string_to_sign = request.method + '\n'
|
||||
|
@ -403,7 +403,7 @@ def _sign_storage_blob_request(request, account_name, account_key):
|
|||
return auth_string
|
||||
|
||||
def _sign_storage_table_request(request, account_name, account_key):
|
||||
uri_path = request.uri.split('?')[0]
|
||||
uri_path = request.path.split('?')[0]
|
||||
|
||||
string_to_sign = request.method + '\n'
|
||||
headers_to_sign = ['content-md5', 'content-type', 'date']
|
||||
|
|
|
@ -54,14 +54,14 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/?comp=list'
|
||||
request.path = '/?comp=list'
|
||||
request.query = [
|
||||
('prefix', _str_or_none(prefix)),
|
||||
('marker', _str_or_none(marker)),
|
||||
('maxresults', _int_or_none(maxresults)),
|
||||
('include', _str_or_none(include))
|
||||
]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -81,12 +81,12 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '?restype=container'
|
||||
request.path = '/' + str(container_name) + '?restype=container'
|
||||
request.headers = [
|
||||
('x-ms-meta-name-values', x_ms_meta_name_values),
|
||||
('x-ms-blob-public-access', _str_or_none(x_ms_blob_public_access))
|
||||
]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
if not fail_on_exist:
|
||||
try:
|
||||
|
@ -107,8 +107,8 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '?restype=container'
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path = '/' + str(container_name) + '?restype=container'
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -123,8 +123,8 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '?restype=container&comp=metadata'
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path = '/' + str(container_name) + '?restype=container&comp=metadata'
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -140,9 +140,9 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '?restype=container&comp=metadata'
|
||||
request.path = '/' + str(container_name) + '?restype=container&comp=metadata'
|
||||
request.headers = [('x-ms-meta-name-values', x_ms_meta_name_values)]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -154,8 +154,8 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '?restype=container&comp=acl'
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path = '/' + str(container_name) + '?restype=container&comp=acl'
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -172,10 +172,10 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '?restype=container&comp=acl'
|
||||
request.path = '/' + str(container_name) + '?restype=container&comp=acl'
|
||||
request.headers = [('x-ms-blob-public-access', _str_or_none(x_ms_blob_public_access))]
|
||||
request.body = _get_request_body(_convert_class_to_xml(signed_identifiers))
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -189,8 +189,8 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'DELETE'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '?restype=container'
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path = '/' + str(container_name) + '?restype=container'
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
if not fail_not_exist:
|
||||
try:
|
||||
|
@ -211,14 +211,14 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '?restype=container&comp=list'
|
||||
request.path = '/' + str(container_name) + '?restype=container&comp=list'
|
||||
request.query = [
|
||||
('prefix', _str_or_none(prefix)),
|
||||
('marker', _str_or_none(marker)),
|
||||
('maxresults', _int_or_none(maxresults)),
|
||||
('include', _str_or_none(include))
|
||||
]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -238,10 +238,10 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/?restype=service&comp=properties'
|
||||
request.path = '/?restype=service&comp=properties'
|
||||
request.query = [('timeout', _int_or_none(timeout))]
|
||||
request.body = _get_request_body(_convert_class_to_xml(storage_service_properties))
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -256,9 +256,9 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/?restype=service&comp=properties'
|
||||
request.path = '/?restype=service&comp=properties'
|
||||
request.query = [('timeout', _int_or_none(timeout))]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -275,9 +275,9 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'HEAD'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '/' + str(blob_name) + ''
|
||||
request.path = '/' + str(container_name) + '/' + str(blob_name) + ''
|
||||
request.headers = [('x-ms-lease-id', _str_or_none(x_ms_lease_id))]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -299,7 +299,7 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '/' + str(blob_name) + '?comp=properties'
|
||||
request.path = '/' + str(container_name) + '/' + str(blob_name) + '?comp=properties'
|
||||
request.headers = [
|
||||
('x-ms-blob-cache-control', _str_or_none(x_ms_blob_cache_control)),
|
||||
('x-ms-blob-content-type', _str_or_none(x_ms_blob_content_type)),
|
||||
|
@ -308,7 +308,7 @@ class BlobService(_StorageClient):
|
|||
('x-ms-blob-content-language', _str_or_none(x_ms_blob_content_language)),
|
||||
('x-ms-lease-id', _str_or_none(x_ms_lease_id))
|
||||
]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -330,7 +330,7 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '/' + str(blob_name) + ''
|
||||
request.path = '/' + str(container_name) + '/' + str(blob_name) + ''
|
||||
request.headers = [
|
||||
('x-ms-blob-type', _str_or_none(x_ms_blob_type)),
|
||||
('Content-Encoding', _str_or_none(content_encoding)),
|
||||
|
@ -348,7 +348,7 @@ class BlobService(_StorageClient):
|
|||
('x-ms-blob-sequence-number', _str_or_none(x_ms_blob_sequence_number))
|
||||
]
|
||||
request.body = _get_request_body(blob)
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -365,14 +365,14 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '/' + str(blob_name) + ''
|
||||
request.path = '/' + str(container_name) + '/' + str(blob_name) + ''
|
||||
request.headers = [
|
||||
('x-ms-range', _str_or_none(x_ms_range)),
|
||||
('x-ms-lease-id', _str_or_none(x_ms_lease_id)),
|
||||
('x-ms-range-get-content-md5', _str_or_none(x_ms_range_get_content_md5))
|
||||
]
|
||||
request.query = [('snapshot', _str_or_none(snapshot))]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -390,10 +390,10 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '/' + str(blob_name) + '?comp=metadata'
|
||||
request.path = '/' + str(container_name) + '/' + str(blob_name) + '?comp=metadata'
|
||||
request.headers = [('x-ms-lease-id', _str_or_none(x_ms_lease_id))]
|
||||
request.query = [('snapshot', _str_or_none(snapshot))]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -412,12 +412,12 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '/' + str(blob_name) + '?comp=metadata'
|
||||
request.path = '/' + str(container_name) + '/' + str(blob_name) + '?comp=metadata'
|
||||
request.headers = [
|
||||
('x-ms-meta-name-values', x_ms_meta_name_values),
|
||||
('x-ms-lease-id', _str_or_none(x_ms_lease_id))
|
||||
]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -436,12 +436,12 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '/' + str(blob_name) + '?comp=lease'
|
||||
request.path = '/' + str(container_name) + '/' + str(blob_name) + '?comp=lease'
|
||||
request.headers = [
|
||||
('x-ms-lease-id', _str_or_none(x_ms_lease_id)),
|
||||
('x-ms-lease-action', _str_or_none(x_ms_lease_action))
|
||||
]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -468,7 +468,7 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '/' + str(blob_name) + '?comp=snapshot'
|
||||
request.path = '/' + str(container_name) + '/' + str(blob_name) + '?comp=snapshot'
|
||||
request.headers = [
|
||||
('x-ms-meta-name-values', x_ms_meta_name_values),
|
||||
('If-Modified-Since', _str_or_none(if_modified_since)),
|
||||
|
@ -477,7 +477,7 @@ class BlobService(_StorageClient):
|
|||
('If-None-Match', _str_or_none(if_none_match)),
|
||||
('x-ms-lease-id', _str_or_none(x_ms_lease_id))
|
||||
]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -513,7 +513,7 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '/' + str(blob_name) + ''
|
||||
request.path = '/' + str(container_name) + '/' + str(blob_name) + ''
|
||||
request.headers = [
|
||||
('x-ms-copy-source', _str_or_none(x_ms_copy_source)),
|
||||
('x-ms-meta-name-values', x_ms_meta_name_values),
|
||||
|
@ -528,7 +528,7 @@ class BlobService(_StorageClient):
|
|||
('x-ms-lease-id', _str_or_none(x_ms_lease_id)),
|
||||
('x-ms-source-lease-id', _str_or_none(x_ms_source_lease_id))
|
||||
]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -552,10 +552,10 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'DELETE'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '/' + str(blob_name) + ''
|
||||
request.path = '/' + str(container_name) + '/' + str(blob_name) + ''
|
||||
request.headers = [('x-ms-lease-id', _str_or_none(x_ms_lease_id))]
|
||||
request.query = [('snapshot', _str_or_none(snapshot))]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -578,14 +578,14 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '/' + str(blob_name) + '?comp=block'
|
||||
request.path = '/' + str(container_name) + '/' + str(blob_name) + '?comp=block'
|
||||
request.headers = [
|
||||
('Content-MD5', _str_or_none(content_m_d5)),
|
||||
('x-ms-lease-id', _str_or_none(x_ms_lease_id))
|
||||
]
|
||||
request.query = [('blockid', base64.b64encode(_str_or_none(blockid)))]
|
||||
request.body = _get_request_body(block)
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -622,7 +622,7 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '/' + str(blob_name) + '?comp=blocklist'
|
||||
request.path = '/' + str(container_name) + '/' + str(blob_name) + '?comp=blocklist'
|
||||
request.headers = [
|
||||
('Content-MD5', _str_or_none(content_m_d5)),
|
||||
('x-ms-blob-cache-control', _str_or_none(x_ms_blob_cache_control)),
|
||||
|
@ -634,7 +634,7 @@ class BlobService(_StorageClient):
|
|||
('x-ms-lease-id', _str_or_none(x_ms_lease_id))
|
||||
]
|
||||
request.body = _get_request_body(convert_block_list_to_xml(block_list))
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -654,13 +654,13 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '/' + str(blob_name) + '?comp=blocklist'
|
||||
request.path = '/' + str(container_name) + '/' + str(blob_name) + '?comp=blocklist'
|
||||
request.headers = [('x-ms-lease-id', _str_or_none(x_ms_lease_id))]
|
||||
request.query = [
|
||||
('snapshot', _str_or_none(snapshot)),
|
||||
('blocklisttype', _str_or_none(blocklisttype))
|
||||
]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -695,7 +695,7 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '/' + str(blob_name) + '?comp=page'
|
||||
request.path = '/' + str(container_name) + '/' + str(blob_name) + '?comp=page'
|
||||
request.headers = [
|
||||
('x-ms-range', _str_or_none(x_ms_range)),
|
||||
('Content-MD5', _str_or_none(content_m_d5)),
|
||||
|
@ -711,7 +711,7 @@ class BlobService(_StorageClient):
|
|||
]
|
||||
request.query = [('timeout', _int_or_none(timeout))]
|
||||
request.body = _get_request_body(page)
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -734,14 +734,14 @@ class BlobService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = _get_blob_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(container_name) + '/' + str(blob_name) + '?comp=pagelist'
|
||||
request.path = '/' + str(container_name) + '/' + str(blob_name) + '?comp=pagelist'
|
||||
request.headers = [
|
||||
('Range', _str_or_none(range)),
|
||||
('x-ms-range', _str_or_none(x_ms_range)),
|
||||
('x-ms-lease-id', _str_or_none(x_ms_lease_id))
|
||||
]
|
||||
request.query = [('snapshot', _str_or_none(snapshot))]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_blob_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
|
|
@ -49,9 +49,9 @@ class QueueService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = _get_queue_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/?restype=service&comp=properties'
|
||||
request.path = '/?restype=service&comp=properties'
|
||||
request.query = [('timeout', _int_or_none(timeout))]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_queue_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -64,14 +64,14 @@ class QueueService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = _get_queue_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/?comp=list'
|
||||
request.path = '/?comp=list'
|
||||
request.query = [
|
||||
('prefix', _str_or_none(prefix)),
|
||||
('marker', _str_or_none(marker)),
|
||||
('maxresults', _int_or_none(maxresults)),
|
||||
('include', _str_or_none(include))
|
||||
]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_queue_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -90,9 +90,9 @@ class QueueService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = _get_queue_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(queue_name) + ''
|
||||
request.path = '/' + str(queue_name) + ''
|
||||
request.headers = [('x-ms-meta-name-values', x_ms_meta_name_values)]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_queue_header(request, self.account_name, self.account_key)
|
||||
if not fail_on_exist:
|
||||
try:
|
||||
|
@ -116,8 +116,8 @@ class QueueService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'DELETE'
|
||||
request.host = _get_queue_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(queue_name) + ''
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path = '/' + str(queue_name) + ''
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_queue_header(request, self.account_name, self.account_key)
|
||||
if not fail_not_exist:
|
||||
try:
|
||||
|
@ -141,8 +141,8 @@ class QueueService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = _get_queue_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(queue_name) + '?comp=metadata'
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path = '/' + str(queue_name) + '?comp=metadata'
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_queue_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -161,9 +161,9 @@ class QueueService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = _get_queue_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(queue_name) + '?comp=metadata'
|
||||
request.path = '/' + str(queue_name) + '?comp=metadata'
|
||||
request.headers = [('x-ms-meta-name-values', x_ms_meta_name_values)]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_queue_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -187,7 +187,7 @@ class QueueService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'POST'
|
||||
request.host = _get_queue_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(queue_name) + '/messages'
|
||||
request.path = '/' + str(queue_name) + '/messages'
|
||||
request.query = [
|
||||
('visibilitytimeout', _str_or_none(visibilitytimeout)),
|
||||
('messagettl', _str_or_none(messagettl))
|
||||
|
@ -196,7 +196,7 @@ class QueueService(_StorageClient):
|
|||
<QueueMessage> \
|
||||
<MessageText>' + xml_escape(str(message_text)) + '</MessageText> \
|
||||
</QueueMessage>')
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_queue_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -219,12 +219,12 @@ class QueueService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = _get_queue_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(queue_name) + '/messages'
|
||||
request.path = '/' + str(queue_name) + '/messages'
|
||||
request.query = [
|
||||
('numofmessages', _str_or_none(numofmessages)),
|
||||
('visibilitytimeout', _str_or_none(visibilitytimeout))
|
||||
]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_queue_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -244,9 +244,9 @@ class QueueService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = _get_queue_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(queue_name) + '/messages?peekonly=true'
|
||||
request.path = '/' + str(queue_name) + '/messages?peekonly=true'
|
||||
request.query = [('numofmessages', _str_or_none(numofmessages))]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_queue_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -266,9 +266,9 @@ class QueueService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'DELETE'
|
||||
request.host = _get_queue_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(queue_name) + '/messages/' + str(message_id) + ''
|
||||
request.path = '/' + str(queue_name) + '/messages/' + str(message_id) + ''
|
||||
request.query = [('popreceipt', _str_or_none(popreceipt))]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_queue_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -282,8 +282,8 @@ class QueueService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'DELETE'
|
||||
request.host = _get_queue_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(queue_name) + '/messages'
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path = '/' + str(queue_name) + '/messages'
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_queue_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -309,7 +309,7 @@ class QueueService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = _get_queue_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(queue_name) + '/messages/' + str(message_id) + ''
|
||||
request.path = '/' + str(queue_name) + '/messages/' + str(message_id) + ''
|
||||
request.query = [
|
||||
('popreceipt', _str_or_none(popreceipt)),
|
||||
('visibilitytimeout', _str_or_none(visibilitytimeout))
|
||||
|
@ -318,7 +318,7 @@ class QueueService(_StorageClient):
|
|||
<QueueMessage> \
|
||||
<MessageText>;' + xml_escape(str(message_text)) + '</MessageText> \
|
||||
</QueueMessage>')
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_queue_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -336,10 +336,10 @@ class QueueService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = _get_queue_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/?restype=service&comp=properties'
|
||||
request.path = '/?restype=service&comp=properties'
|
||||
request.query = [('timeout', _int_or_none(timeout))]
|
||||
request.body = _get_request_body(_convert_class_to_xml(storage_service_properties))
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_queue_header(request, self.account_name, self.account_key)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ class TableService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = _get_table_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/?restype=service&comp=properties'
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path = '/?restype=service&comp=properties'
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_table_header(request)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -82,9 +82,9 @@ class TableService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = _get_table_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/?restype=service&comp=properties'
|
||||
request.path = '/?restype=service&comp=properties'
|
||||
request.body = _get_request_body(_convert_class_to_xml(storage_service_properties))
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_table_header(request)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -104,9 +104,9 @@ class TableService(_StorageClient):
|
|||
uri_part_table_name = "('" + table_name + "')"
|
||||
else:
|
||||
uri_part_table_name = ""
|
||||
request.uri = '/Tables' + uri_part_table_name + ''
|
||||
request.path = '/Tables' + uri_part_table_name + ''
|
||||
request.query = [('$top', _int_or_none(top))]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_table_header(request)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -123,9 +123,9 @@ class TableService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'POST'
|
||||
request.host = _get_table_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/Tables'
|
||||
request.path = '/Tables'
|
||||
request.body = _get_request_body(convert_table_to_xml(table))
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_table_header(request)
|
||||
if not fail_on_exist:
|
||||
try:
|
||||
|
@ -148,8 +148,8 @@ class TableService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'DELETE'
|
||||
request.host = _get_table_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/Tables(\'' + str(table_name) + '\')'
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path = '/Tables(\'' + str(table_name) + '\')'
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_table_header(request)
|
||||
if not fail_not_exist:
|
||||
try:
|
||||
|
@ -177,8 +177,8 @@ class TableService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = _get_table_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(table_name) + '(PartitionKey=\'' + str(partition_key) + '\',RowKey=\'' + str(row_key) + '\')?$select=' + str(comma_separated_property_names) + ''
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path = '/' + str(table_name) + '(PartitionKey=\'' + str(partition_key) + '\',RowKey=\'' + str(row_key) + '\')?$select=' + str(comma_separated_property_names) + ''
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_table_header(request)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -197,13 +197,13 @@ class TableService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'GET'
|
||||
request.host = _get_table_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(table_name) + '()'
|
||||
request.path = '/' + str(table_name) + '()'
|
||||
request.query = [
|
||||
('$filter', _str_or_none(filter)),
|
||||
('$select', _str_or_none(select)),
|
||||
('$top', _int_or_none(top))
|
||||
]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_table_header(request)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -222,10 +222,10 @@ class TableService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'POST'
|
||||
request.host = _get_table_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(table_name) + ''
|
||||
request.path = '/' + str(table_name) + ''
|
||||
request.headers = [('Content-Type', _str_or_none(content_type))]
|
||||
request.body = _get_request_body(convert_entity_to_xml(entity))
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_table_header(request)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -247,13 +247,13 @@ class TableService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = _get_table_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(table_name) + '(PartitionKey=\'' + str(partition_key) + '\',RowKey=\'' + str(row_key) + '\')'
|
||||
request.path = '/' + str(table_name) + '(PartitionKey=\'' + str(partition_key) + '\',RowKey=\'' + str(row_key) + '\')'
|
||||
request.headers = [
|
||||
('Content-Type', _str_or_none(content_type)),
|
||||
('If-Match', _str_or_none(if_match))
|
||||
]
|
||||
request.body = _get_request_body(convert_entity_to_xml(entity))
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_table_header(request)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -275,13 +275,13 @@ class TableService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'MERGE'
|
||||
request.host = _get_table_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(table_name) + '(PartitionKey=\'' + str(partition_key) + '\',RowKey=\'' + str(row_key) + '\')'
|
||||
request.path = '/' + str(table_name) + '(PartitionKey=\'' + str(partition_key) + '\',RowKey=\'' + str(row_key) + '\')'
|
||||
request.headers = [
|
||||
('Content-Type', _str_or_none(content_type)),
|
||||
('If-Match', _str_or_none(if_match))
|
||||
]
|
||||
request.body = _get_request_body(convert_entity_to_xml(entity))
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_table_header(request)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -303,12 +303,12 @@ class TableService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'DELETE'
|
||||
request.host = _get_table_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(table_name) + '(PartitionKey=\'' + str(partition_key) + '\',RowKey=\'' + str(row_key) + '\')'
|
||||
request.path = '/' + str(table_name) + '(PartitionKey=\'' + str(partition_key) + '\',RowKey=\'' + str(row_key) + '\')'
|
||||
request.headers = [
|
||||
('Content-Type', _str_or_none(content_type)),
|
||||
('If-Match', _str_or_none(if_match))
|
||||
]
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_table_header(request)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -331,10 +331,10 @@ class TableService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'PUT'
|
||||
request.host = _get_table_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(table_name) + '(PartitionKey=\'' + str(partition_key) + '\',RowKey=\'' + str(row_key) + '\')'
|
||||
request.path = '/' + str(table_name) + '(PartitionKey=\'' + str(partition_key) + '\',RowKey=\'' + str(row_key) + '\')'
|
||||
request.headers = [('Content-Type', _str_or_none(content_type))]
|
||||
request.body = _get_request_body(convert_entity_to_xml(entity))
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_table_header(request)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
@ -357,13 +357,13 @@ class TableService(_StorageClient):
|
|||
request = HTTPRequest()
|
||||
request.method = 'MERGE'
|
||||
request.host = _get_table_host(self.account_name, self.use_local_storage)
|
||||
request.uri = '/' + str(table_name) + '(PartitionKey=\'' + str(partition_key) + '\',RowKey=\'' + str(row_key) + '\')'
|
||||
request.path = '/' + str(table_name) + '(PartitionKey=\'' + str(partition_key) + '\',RowKey=\'' + str(row_key) + '\')'
|
||||
request.headers = [
|
||||
('Content-Type', _str_or_none(content_type)),
|
||||
('If-Match', _str_or_none(if_match))
|
||||
]
|
||||
request.body = _get_request_body(convert_entity_to_xml(entity))
|
||||
request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)
|
||||
request.headers = _update_storage_table_header(request)
|
||||
response = self._perform_request(request)
|
||||
|
||||
|
|
|
@ -283,7 +283,7 @@ def output_method_body(return_type, method_params, uri_param, req_protocol, req_
|
|||
if extra:
|
||||
output_body += extra
|
||||
|
||||
output_body += ''.join([indent*2, 'request.uri = \'', req_uri, '\'\n'])
|
||||
output_body += ''.join([indent*2, 'request.path = \'', req_uri, '\'\n'])
|
||||
|
||||
output_body += output_headers('request.headers', req_header)
|
||||
output_body += output_query('request.query', req_query)
|
||||
|
@ -325,9 +325,9 @@ def output_method_body(return_type, method_params, uri_param, req_protocol, req_
|
|||
elif req_body.strip():
|
||||
output_body += ''.join([indent*2, 'request.body = _get_request_body(\'', req_body.strip(), '\')\n'])
|
||||
if SERVICE_BUS_HOST_BASE in req_host:
|
||||
output_body += indent*2 + 'request.uri, request.query = _update_request_uri_query(request)\n'
|
||||
output_body += indent*2 + 'request.path, request.query = _update_request_uri_query(request)\n'
|
||||
else:
|
||||
output_body += indent*2 + 'request.uri, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)\n'
|
||||
output_body += indent*2 + 'request.path, request.query = _update_request_uri_query_local_storage(request, self.use_local_storage)\n'
|
||||
|
||||
|
||||
if 'servicebus' in req_host:
|
||||
|
|
|
@ -736,7 +736,7 @@ class BlobServiceTest(unittest.TestCase):
|
|||
self.assertIsInstance(item, (str, unicode, type(None)))
|
||||
self.assertIsInstance(request.host, (str, unicode))
|
||||
self.assertIsInstance(request.method, (str, unicode))
|
||||
self.assertIsInstance(request.uri, (str, unicode))
|
||||
self.assertIsInstance(request.path, (str, unicode))
|
||||
self.assertIsInstance(request.query, list)
|
||||
self.assertIsInstance(request.body, (str, unicode))
|
||||
response = next(request)
|
||||
|
|
|
@ -108,7 +108,7 @@ class ServiceBusTest(unittest.TestCase):
|
|||
|
||||
# Act
|
||||
queue_options = Queue()
|
||||
queue_options.max_size_in_megabytes = '5120'
|
||||
queue_options.max_size_in_megabytes = 5120
|
||||
queue_options.default_message_time_to_live = 'PT1M'
|
||||
created = self.sbs.create_queue(self.queue_name, queue_options)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче