here.platform.api.data_blob_api module#
This module contains a DataBlobApi class to perform API operations.
The HERE API reference documentation used in this module can be found here: Blob API Reference # noqa E501
- class here.platform.api.data_blob_api.DataBlobApi(base_url: str, auth: Auth | None, platform_config: PlatformConfig, application_config: ApplicationConfig, proxies: dict | None = None)[source]#
Bases:
BaseApiThis class provides access to HERE platform Blob APIs.
The blob service supports the upload and retrieval of large volumes of data from the storage of a catalog.
- cancel_multipart_upload_by_handle(layer_id: str, data_handle: str, multipart_token: str, billing_tag: str | None = None)[source]#
Cancel an entire multipart upload operation by handle.
- Parameters:
layer_id – The ID of the parent layer for this blob.
data_handle – The data handle (ID) represents an identifier for the data blob.
multipart_token – The identifier of the multipart upload (token). Content of this parameter must refer to a valid token which when the multipart upload was initiated.
billing_tag – A string which is used for grouping billing records.
- Raises:
PlatformException – If platform responds with an HTTP error.
- check_handle_exists(layer_id: str, data_handle: str, billing_tag: str | None = None) bool[source]#
Check if a blob exists for the requested data handle.
- Parameters:
layer_id – The ID of the parent layer for this blob.
data_handle – The data handle identifies a specific blob so that you can get that blob’s contents.
billing_tag – A string which is used for grouping billing records.
- Returns:
a boolean indicating if the handle exists.
- Raises:
PlatformException – If platform responds with an HTTP error.
- complete_multipart_upload_by_handle(complete_href_url: str, parts: list, billing_tag: str | None = None)[source]#
Completes a multipart upload by handle.
- Parameters:
complete_href_url – The complete href url.
parts – A list of dict representing part_ids uploaded in multipart upload.
billing_tag – A string which is used for grouping billing records.
- Raises:
PlatformException – If platform responds with an HTTP error.
- delete_blob_by_handle(layer_id: str, data_handle: str, billing_tag: str | None = None)[source]#
Delete blob (raw bytes) for given layer ID and data-handle from storage.
- Parameters:
layer_id – The ID of the parent layer for this blob.
data_handle – The data handle identifies a specific blob so that you can get that blob’s contents.
billing_tag – A string which is used for grouping billing records.
- Raises:
PlatformException – If platform responds with an HTTP error.
- get_blob_by_handle(layer_id: str, data_handle: str, range_header: str | None = None, billing_tag: str | None = None, stream: bool = False, chunk_size: int = 102400, storage_layer_access=False) bytes | Iterator[bytes][source]#
Get blob (raw bytes) for given layer ID and data-handle from storage.
- Parameters:
layer_id – The ID of the parent layer for this blob.
data_handle – The data handle identifies a specific blob so that you can get that blob’s contents.
range_header – an optional Range parameter to resume download of a large response when there is a connection issue between the client and server, or to fetch a specific slice of the blob. To resume download after a connection issue, specify a single byte range offset as follows: Range: bytes=10-. To fetch a specific slice of the blob, specify a slice as follows: Range: bytes=10-100. This parameter is compliant with RFC 7233, but note that this parameter only supports a single byte range. The range parameter can also be specified as a query parameter, i.e. range=bytes=10-.
billing_tag – A string which is used for grouping billing records.
stream – whether to stream data.
chunk_size – the size to request each iteration when streaming data.
storage_layer_access – whether to request direct access to the storage layer
- Returns:
a blob response as bytes
- Raises:
PlatformException – If platform responds with an HTTP error.
- get_multipart_upload_status_by_handle(layer_id: str, data_handle: str, multipart_token: str, billing_tag: str | None = None) dict[source]#
Get the status of a multipart upload by handle.
- Parameters:
layer_id – The ID of the parent layer for this blob.
data_handle – The data handle (ID) represents an identifier for the data blob.
multipart_token – The identifier of the multipart upload (token). Content of this parameter must refer to a valid token which when the multipart upload was initiated.
billing_tag – A string which is used for grouping billing records.
- Returns:
response from the API.
- Raises:
PlatformException – If platform responds with an HTTP error.
- publish_blob_by_handle(layer_id: str, data_handle: str, data: bytes, content_length: int, content_encoding: str | None = None, content_type: str | None = None, billing_tag: str | None = None) None[source]#
Publish blob (raw bytes) for given layer ID.
- Parameters:
layer_id – The ID of the parent layer for this blob.
data_handle – The data handle (ID) represents an identifier for the data blob.
data – blob data in bytes
content_length – Size of the entity-body, in bytes. For more information, see RFC 7230, section 3.3.2: Content-Length.
content_encoding – A string representing content encodings applied to data.
content_type – A string representing format of the data. The value of this field must be equal to the one specified in the contentType field in the catalog layer configuration.
billing_tag – A string which is used for grouping billing records.
- Raises:
PlatformException – If platform responds with an HTTP error.
- start_multipart_upload_by_handle(layer_id: str, data_handle: str, content_type: str, content_encoding: str = 'identity', billing_tag: str | None = None) dict[source]#
Publish large data blobs where the data payload needs to be split into multiple parts. The multipart upload start is to be followed by the individual parts upload and completed with a call to complete the upload. The limit of the blob uploaded this way is 50GB.
- Parameters:
layer_id – The ID of the parent layer for this blob.
data_handle – The data handle (ID) represents an identifier for the data blob.
content_type – A string representing format of the blob data. The value of this field must be equal to the one specified in the contentType field in the catalog layer configuration.
content_encoding – A string representing content encodings applied to blob.
billing_tag – A string which is used for grouping billing records.
- Returns:
response from the API.
- Raises:
PlatformException – If platform responds with an HTTP error.
- upload_part_by_handle(layer_id: str, data_handle: str, multipart_token: str, part_number: int, content_length: int, content_type: str, billing_tag: str | None = None) dict[source]#
Upload a single part of a multipart upload for the blob. Every uploaded part except the last one must have a minimum 5 MB of data and a maximum of 96 MB. The length of every part except the last one must be a multiple of 1MB (1024KB). The maximum number of parts is 10,000.
- Parameters:
layer_id – The ID of the parent layer for this blob.
data_handle – The data handle (ID) represents an identifier for the data blob.
multipart_token – The identifier of the multipart upload (token). Content of this parameter must refer to a valid token which when the multipart upload was initiated.
part_number – The number of the part for the multi part upload. The numbers of the upload parts must start from 1, be no greater than 10,000 and be consecutive. Parts uploaded with the same partNumber are overridden. Do not reuse the same partNumber when retrying an upload in an error situation (network problems, 4xx or 5xx responses) Reusing the same partNumber in a retry may cause the publication to fail.
- :param content_length:Size of the entity-body, in bytes. For more information, see
RFC 7230, section 3.3.2: Content-Length.
- Parameters:
content_type – A standard MIME type describing the format of the blob data. For more information, see RFC 2616, section 14.17: Content-Type. The value of this header must match the content type specified in the contentType field when the multipart upload was initialized, and this content type must also match the content type specified in the layer’s configuration.
billing_tag – A string which is used for grouping billing records.
- Returns:
response from the API.
- Raises:
PlatformException – If platform responds with an HTTP error.