How to use the azure-storage-blob.azure.storage.blob._serialization._validate_and_format_range_headers function in azure-storage-blob

To help you get started, we’ve selected a few azure-storage-blob examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-storage-python / azure-storage-storage / blob / appendblobservice.py View on Github external
'x-ms-copy-source': copy_source_url,
            'x-ms-source-content-md5': source_content_md5,
            'x-ms-source-if-Modified-Since': _datetime_to_utc_string(source_if_modified_since),
            'x-ms-source-if-Unmodified-Since': _datetime_to_utc_string(source_if_unmodified_since),
            'x-ms-source-if-Match': _to_str(source_if_match),
            'x-ms-source-if-None-Match': _to_str(source_if_none_match),
            'x-ms-blob-condition-maxsize': _to_str(maxsize_condition),
            'x-ms-blob-condition-appendpos': _to_str(appendpos_condition),
            'x-ms-lease-id': _to_str(lease_id),
            'If-Modified-Since': _datetime_to_utc_string(if_modified_since),
            'If-Unmodified-Since': _datetime_to_utc_string(if_unmodified_since),
            'If-Match': _to_str(if_match),
            'If-None-Match': _to_str(if_none_match)
        }

        _validate_and_format_range_headers(request, source_range_start, source_range_end,
                                           start_range_required=False,
                                           end_range_required=False,
                                           range_header_name="x-ms-source-range")

        return self._perform_request(request, _parse_append_block)
github Azure / azure-storage-python / azure-storage-storage / blob / blockblobservice.py View on Github external
request = HTTPRequest()
        request.method = 'PUT'
        request.host_locations = self._get_host_locations()
        request.path = _get_path(container_name, blob_name)
        request.query = {
            'comp': 'block',
            'blockid': _encode_base64(_to_str(block_id)),
            'timeout': _int_to_str(timeout),
        }
        request.headers = {
            'x-ms-lease-id': _to_str(lease_id),
            'x-ms-copy-source': copy_source_url,
            'x-ms-source-content-md5': source_content_md5,
        }
        _validate_and_format_range_headers(
            request,
            source_range_start,
            source_range_end,
            start_range_required=False,
            end_range_required=False,
            range_header_name="x-ms-source-range"
        )

        self._perform_request(request)
github Azure / azure-storage-python / azure-storage-storage / blob / pageblobservice.py View on Github external
'x-ms-copy-source': copy_source_url,
            'x-ms-source-content-md5': source_content_md5,
            'x-ms-source-if-Modified-Since': _datetime_to_utc_string(source_if_modified_since),
            'x-ms-source-if-Unmodified-Since': _datetime_to_utc_string(source_if_unmodified_since),
            'x-ms-source-if-Match': _to_str(source_if_match),
            'x-ms-source-if-None-Match': _to_str(source_if_none_match),
            'x-ms-lease-id': _to_str(lease_id),
            'x-ms-if-sequence-number-le': _to_str(if_sequence_number_lte),
            'x-ms-if-sequence-number-lt': _to_str(if_sequence_number_lt),
            'x-ms-if-sequence-number-eq': _to_str(if_sequence_number_eq),
            'If-Modified-Since': _datetime_to_utc_string(if_modified_since),
            'If-Unmodified-Since': _datetime_to_utc_string(if_unmodified_since),
            'If-Match': _to_str(if_match),
            'If-None-Match': _to_str(if_none_match)
        }
        _validate_and_format_range_headers(
            request,
            start_range,
            end_range,
            align_to_page=True)
        _validate_and_format_range_headers(
            request,
            source_range_start,
            source_range_start+(end_range-start_range),
            range_header_name="x-ms-source-range")

        return self._perform_request(request, _parse_page_properties)
github Azure / azure-storage-python / azure-storage-storage / blob / pageblobservice.py View on Github external
request.path = _get_path(container_name, blob_name)
        request.query = {
            'comp': 'pagelist',
            'snapshot': _to_str(snapshot),
            'prevsnapshot': _to_str(previous_snapshot),
            'timeout': _int_to_str(timeout),
        }
        request.headers = {
            'x-ms-lease-id': _to_str(lease_id),
            'If-Modified-Since': _datetime_to_utc_string(if_modified_since),
            'If-Unmodified-Since': _datetime_to_utc_string(if_unmodified_since),
            'If-Match': _to_str(if_match),
            'If-None-Match': _to_str(if_none_match),
        }
        if start_range is not None:
            _validate_and_format_range_headers(
                request,
                start_range,
                end_range,
                start_range_required=False,
                end_range_required=False,
                align_to_page=True)

        return self._perform_request(request, _convert_xml_to_page_ranges)
github Azure / azure-storage-python / azure-storage-storage / blob / pageblobservice.py View on Github external
request.query = {
            'comp': 'page',
            'timeout': _int_to_str(timeout),
        }
        request.headers = {
            'x-ms-page-write': 'update',
            'x-ms-lease-id': _to_str(lease_id),
            'x-ms-if-sequence-number-le': _to_str(if_sequence_number_lte),
            'x-ms-if-sequence-number-lt': _to_str(if_sequence_number_lt),
            'x-ms-if-sequence-number-eq': _to_str(if_sequence_number_eq),
            'If-Modified-Since': _datetime_to_utc_string(if_modified_since),
            'If-Unmodified-Since': _datetime_to_utc_string(if_unmodified_since),
            'If-Match': _to_str(if_match),
            'If-None-Match': _to_str(if_none_match)
        }
        _validate_and_format_range_headers(
            request,
            start_range,
            end_range,
            align_to_page=True)
        request.body = _get_data_bytes_only('page', page)

        if validate_content:
            computed_md5 = _get_content_md5(request.body)
            request.headers['Content-MD5'] = _to_str(computed_md5)

        return self._perform_request(request, _parse_page_properties)
github Azure / azure-storage-python / azure-storage-storage / blob / pageblobservice.py View on Github external
'x-ms-source-if-None-Match': _to_str(source_if_none_match),
            'x-ms-lease-id': _to_str(lease_id),
            'x-ms-if-sequence-number-le': _to_str(if_sequence_number_lte),
            'x-ms-if-sequence-number-lt': _to_str(if_sequence_number_lt),
            'x-ms-if-sequence-number-eq': _to_str(if_sequence_number_eq),
            'If-Modified-Since': _datetime_to_utc_string(if_modified_since),
            'If-Unmodified-Since': _datetime_to_utc_string(if_unmodified_since),
            'If-Match': _to_str(if_match),
            'If-None-Match': _to_str(if_none_match)
        }
        _validate_and_format_range_headers(
            request,
            start_range,
            end_range,
            align_to_page=True)
        _validate_and_format_range_headers(
            request,
            source_range_start,
            source_range_start+(end_range-start_range),
            range_header_name="x-ms-source-range")

        return self._perform_request(request, _parse_page_properties)
github Azure / azure-storage-python / azure-storage-storage / blob / pageblobservice.py View on Github external
request.query = {
            'comp': 'page',
            'timeout': _int_to_str(timeout),
        }
        request.headers = {
            'x-ms-page-write': 'clear',
            'x-ms-lease-id': _to_str(lease_id),
            'x-ms-if-sequence-number-le': _to_str(if_sequence_number_lte),
            'x-ms-if-sequence-number-lt': _to_str(if_sequence_number_lt),
            'x-ms-if-sequence-number-eq': _to_str(if_sequence_number_eq),
            'If-Modified-Since': _datetime_to_utc_string(if_modified_since),
            'If-Unmodified-Since': _datetime_to_utc_string(if_unmodified_since),
            'If-Match': _to_str(if_match),
            'If-None-Match': _to_str(if_none_match)
        }
        _validate_and_format_range_headers(
            request,
            start_range,
            end_range,
            align_to_page=True)

        return self._perform_request(request, _parse_page_properties)
github Azure / azure-storage-python / azure-storage-storage / blob / pageblobservice.py View on Github external
request.host_locations = self._get_host_locations(secondary=True)
        request.path = _get_path(container_name, blob_name)
        request.query = {
            'comp': 'pagelist',
            'snapshot': _to_str(snapshot),
            'timeout': _int_to_str(timeout),
        }
        request.headers = {
            'x-ms-lease-id': _to_str(lease_id),
            'If-Modified-Since': _datetime_to_utc_string(if_modified_since),
            'If-Unmodified-Since': _datetime_to_utc_string(if_unmodified_since),
            'If-Match': _to_str(if_match),
            'If-None-Match': _to_str(if_none_match),
        }
        if start_range is not None:
            _validate_and_format_range_headers(
                request,
                start_range,
                end_range,
                start_range_required=False,
                end_range_required=False,
                align_to_page=True)

        return self._perform_request(request, _convert_xml_to_page_ranges)

azure-storage-blob

Microsoft Azure Blob Storage Client Library for Python

MIT
Latest version published 2 months ago

Package Health Score

96 / 100
Full package analysis