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_file(response, name, validate_content=False):
if response is None:
return None
metadata = _parse_metadata(response)
props = _parse_properties(response, FileProperties)
# For range gets, only look at 'x-ms-content-md5' for overall MD5
content_settings = getattr(props, 'content_settings')
if 'content-range' in response.headers:
if 'x-ms-content-md5' in response.headers:
setattr(content_settings, 'content_md5', _to_str(response.headers['x-ms-content-md5']))
else:
delattr(content_settings, 'content_md5')
if validate_content:
computed_md5 = _get_content_md5(response.body)
_validate_content_match(response.headers['content-md5'], computed_md5)
return File(name, response.body, props, metadata)
def __init__(self, name=None, content=None, props=None, metadata=None):
self.name = name
self.content = content
self.properties = props or FileProperties()
self.metadata = metadata
'''
_validate_not_none('share_name', share_name)
_validate_not_none('file_name', file_name)
_validate_not_none('copy_source', copy_source)
request = HTTPRequest()
request.method = 'PUT'
request.host_locations = self._get_host_locations()
request.path = _get_path(share_name, directory_name, file_name)
request.query = {'timeout': _int_to_str(timeout)}
request.headers = {
'x-ms-copy-source': _to_str(copy_source),
}
_add_metadata_headers(metadata, request)
return self._perform_request(request, _parse_properties, [FileProperties]).copy