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_share(response, name, snapshot=None):
if response is None:
return None
metadata = _parse_metadata(response)
props = _parse_properties(response, ShareProperties)
return Share(name, props, metadata, snapshot)
'''
if response is None or response.body is None:
return None
shares = _list()
list_element = ETree.fromstring(response.body)
# Set next marker
next_marker = list_element.findtext('NextMarker') or None
setattr(shares, 'next_marker', next_marker)
shares_element = list_element.find('Shares')
for share_element in shares_element.findall('Share'):
# Name element
share = Share()
share.name = share_element.findtext('Name')
# Snapshot
share.snapshot = share_element.findtext('Snapshot')
# Metadata
metadata_root_element = share_element.find('Metadata')
if metadata_root_element is not None:
share.metadata = dict()
for metadata_element in metadata_root_element:
share.metadata[metadata_element.tag] = metadata_element.text
# Properties
properties_element = share_element.find('Properties')
share.properties.last_modified = parser.parse(properties_element.findtext('Last-Modified'))
share.properties.etag = properties_element.findtext('Etag')