This module contains a DataVolatileBlobApi class to perform API operations.

The HERE API reference documentation used in this module can be found here: By Key Object Blob API Reference By Key # noqa E501 By Handle Object Blob API Reference By Handle # noqa E501

class here.platform.api.data_object_blob_api.DataObjectBlobApi(base_url: str, platform_config: PlatformConfig, application_config: ApplicationConfig, auth: Auth | None, proxies: dict | None)[source]#

Bases: BaseApi

This class provides access to HERE platform Data Blob APIs v2.

The data-blob-api-v2 service supports the upload and retrieval of objects stored in ObjectStore layers. Two types of uploads can be done with this layer - Single and Multipart. The single part upload can be used for objects up to 192 MB. Use multipart upload for any data objects larger than 192 MB. Every multipart upload uses the token from previous multipart upload response. Before doing any multipart upload, wait for the response from previous multipart upload, if any. Also, while reading, objects can be read in part by passing a Range Header. Example, Range: bytes=10-

cancel_multipart_upload(layer_id, multipart_token, billing_tag: str | None = None)[source]#
Cancels an entire multipart upload operation. You can only cancel

a multipart upload before

it has been completed.

Parameters:
  • layer_id – ID of the object store layer.

  • multipart_token – The identifier of the multipart upload (token). This token is returned when the multipart upload is initiated.

  • billing_tag – A string to represent a grouping of billing records

Raises:

PlatformException – If platform responds with an HTTP error.

complete_multipart_upload(layer_id: str, multipart_token: str, data: dict, billing_tag: str | None = None)[source]#

Completes a multipart upload by handle.

Parameters:
  • layer_id – ID of the object store layer.

  • multipart_token – The identifier of the multipart upload (token). This token is returned when the multipart upload is initiated.

  • data – It is list of dict object which holds id of uploaded parts and part_number

  • billing_tag – A string which is used for grouping billing records.

Raises:

PlatformException – If platform responds with an HTTP error.

delete_object(layer_id: str, key: str, billing_tag: str | None = None)[source]#

Deletes the object with :param:`key` from the object store layer.

Parameters:
  • layer_id – ID of the object store layer.

  • key – key for the object to be deleted.

  • billing_tag – A string to represent a grouping of billing records

Raises:

PlatformException – If platform responds with an HTTP error.

get_multipart_upload_status(layer_id, multipart_token, billing_tag: str | None = None)[source]#
Gets the status of a multipart upload.

The status can be received only when the upload has been completed.

Parameters:
  • layer_id – ID of the object store layer.

  • multipart_token – The identifier of the multipart upload (token). This token is returned when the multipart upload is initiated.

  • billing_tag – A string to represent a grouping of billing records

Returns:

returns status of multipart upload.

Raises:

PlatformException – If platform responds with an HTTP error.

get_object(layer_id: str, key: str, only_meta: bool, billing_tag: str | None = None, stream: bool = False, storage_layer_access=False) Response[source]#

Fetches the object against a :param:`key` in layer with ID :param:`layer_id`.

Parameters:
  • layer_id – ID of the object store layer

  • key – key for the object to be fetched

  • only_meta – fetch only metadata

  • billing_tag – A string to represent a grouping of billing records

  • stream – whether to stream data

  • storage_layer_access – whether to request direct access to the storage layer

Returns:

object data against given :param:`key`

Raises:

PlatformException – If platform responds with an HTTP error

key_exists(layer_id: str, key: str, billing_tag: str | None = None) bool[source]#

Checks whether the object with :param:`key` exists in the object store layer.

list_keys(layer_id: str, params: dict) Any[source]#

List all the keys present in the object store layer.

put_object(layer_id: str, key: str, object_data: bytes | None = None, headers: dict | None = None, source: str | None = None, billing_tag: str | None = None) Any[source]#

Uploads the :param:`object_data` against given :param:`key` in layer with ID :param:`layer_id`.

Parameters:
  • layer_id – ID of the object store layer

  • key – key for the object to be uploaded

  • object_data – object to be uploaded

  • headers – additional request header fields like content-length, and content-type which can be provided while uploading object.

  • source – source to copy an existing object, instead of uploading a new one, If this parameter is present, the object_data must be empty.

  • billing_tag – A string to represent a grouping of billing records

Returns:

status response after putting the object

Raises:

PlatformException – If platform responds with an HTTP error

start_multipart_upload(layer_id: str, key: str, content_type: str, billing_tag: str | None = None, content_encoding: str | None = None)[source]#
The multipart upload start is to be followed by the individual parts upload and

completed with a call to complete the upload

Parameters:

layer_id – ID of the object store layer.

:param key:The key identifies a specific blob so that you can get that blob’s contents :param content_type: A standard MIME type describing the format of the blob data. :param billing_tag: A string to represent a grouping of billing records :param content_encoding: Content-encoding of the object. This field is optional.

Returns:

returns multipart token

Raises:

PlatformException – If platform responds with an HTTP error.

async upload_blob_part(layer_id: str, multipart_token: str, part_number: int, object_part: bytes, content_type: str, billing_tag: str | None = None)[source]#
The multipart upload start is to be followed by the individual parts upload and

completed with a call to complete the upload

Parameters:
  • layer_id – ID of the object store layer.

  • multipart_token – The identifier of the multipart upload (token). This token is returned when the multipart upload is 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.

  • object_part – object part to be uploaded

  • 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 to represent a grouping of billing records

Returns:

returns multipart token

Raises:

PlatformException – If platform responds with an HTTP error.