Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _parse_queue_message_from_headers(response):
'''
Extracts pop receipt and time next visible from headers.
'''
message = QueueMessage()
message.pop_receipt = response.headers.get('x-ms-popreceipt')
message.time_next_visible = parser.parse(response.headers.get('x-ms-time-next-visible'))
return message
expiration-time
opaque-string-receipt-data
time-next-visible
integer
message-body
'''
if response is None or response.body is None:
return None
messages = list()
list_element = ETree.fromstring(response.body)
for message_element in list_element.findall('QueueMessage'):
message = QueueMessage()
message.id = message_element.findtext('MessageId')
dequeue_count = message_element.findtext('DequeueCount')
if dequeue_count is not None:
message.dequeue_count = _to_int(dequeue_count)
# content is not returned for put_message
if content is not None:
message.content = content
else:
message.content = message_element.findtext('MessageText')
if (key_encryption_key is not None) or (resolver is not None):
message.content = _decrypt_queue_message(message.content, require_encryption,
key_encryption_key, resolver)
message.content = decode_function(message.content)