HERE platform service abstraction.

class here.platform.service.Service(hrn: str, configuration: ServiceConfiguration, platform: Platform)[source]#

Bases: object

HERE platform service abstraction.

Access basic fields like name, summary, base_url, logging_url, and tags of a service. Example: service.name

More fields can be read by using service configuration Example: service.configuration

delete(path: str, params: Dict | None = None, headers: dict | None = None, as_json: bool = True, success_codes: List[int] = [200], **kwargs) Any[source]#

Perform a DELETE request on the service for the given :param:`path` of the service Example, service.delete(“/path”, params={…})

Parameters:
  • path – path to be called on the service.

  • params – parameters to pass to the API.

  • headers – Request headers. Defaults to the api headers property.

  • as_json – A boolean to indicate type of response. If True then response will be returned in json format.

  • success_codes – List of http response codes which are treated as success

  • kwargs – Optional arguments that can be passed to requests’ DELETE call

Raises:

PlatformException – in case of unsuccessful response

Returns:

response from the API.

get(path: str, params: dict | None = None, headers: dict | None = None, as_json: bool = True, success_codes: List[int] = [200], **kwargs) Any[source]#

Perform a GET request on the service for the given :param:`path` of the service Example, service.get(“/path”)

Parameters:
  • path – path to be called on the service.

  • params – Parameters to pass to the API.

  • headers – Request headers. Defaults to the Api headers property.

  • as_json – A boolean to indicate type of response. If True then response will be returned in json format. If False, requests.Response object will be returned

  • success_codes – List of http response codes which are treated as success

  • kwargs – Optional arguments that can be passed to requests’ GET call

Returns:

response from the API.

Raises:

PlatformException – in case of unsuccessful response

get_version()[source]#

Detailed version information of the service

head(path: str, params: dict | None = None, headers: dict | None = None, as_json: bool = False, success_codes: List[int] = [200], **kwargs) Any[source]#

Perform a HEAD request on the service for the given :param:`path` of the service Example, service.head(“/path”)

Parameters:
  • path – path to be called on the service.

  • params – Parameters to pass to the API.

  • headers – Request headers. Defaults to the api headers property.

  • as_json – A boolean to indicate type of response. If True then response will be returned in json format.

  • success_codes – List of http response codes which are treated as success

  • kwargs – Optional arguments that can be passed to requests’ HEAD call

Returns:

response from the API.

Raises:

PlatformException – in case of unsuccessful response

property health#

Current health of the service

open_in_portal()[source]#

Opens the service page on HERE platform portal.

patch(path: str, data: dict | None = None, params: dict | None = None, headers: dict | None = None, as_json: bool = True, success_codes: List[int] = [200], **kwargs) Any[source]#

Perform a PATCH request on the service for the given :param:`path` of the service Example, service.patch(“/path”, params={…})

Parameters:
  • path – path to be called on the service.

  • data – Patch data for http request.

  • params – Parameters to pass to the API.

  • headers – Request headers. Defaults to the api headers property.

  • as_json – A boolean to indicate type of response. If True then response will be returned in json format.

  • success_codes – List of http response codes which are treated as success

  • kwargs – Optional arguments that can be passed to requests’ PATCH call

Returns:

response from the API.

Raises:

PlatformException – in case of unsuccessful response

post(path: str, data: dict | List | bytes | str | None = None, params: dict | None = None, headers: dict | None = None, as_json: bool = True, success_codes: List[int] = [200, 201], **kwargs) Any[source]#

Perform a POST request on the service for the given :param:`path` of the service Example, service.post(“/path”, params={…})

Parameters:
  • path – path to be called on the service.

  • data – Dictionary, list of tuples, bytes, or file-like object to send in the body of the http request.

  • params – Parameters to pass to the API.

  • headers – Request headers. Defaults to the api headers property. Overrides the default headers one by one leaving the ones that are not overridden

  • as_json – A boolean to indicate type of response. If True then response will be returned in json format.

  • success_codes – List of http response codes which are treated as success

  • kwargs – Optional arguments that can be passed to requests’ POST call

Returns:

response from the API.

Raises:

PlatformException – in case of unsuccessful response

put(path: str, data: dict | None = None, params: dict | None = None, headers: dict | None = None, as_json: bool = True, success_codes: List[int] = [200], **kwargs) Any[source]#

Perform a PUT request on the service for the given :param:`path` of the service Example, service.put(“/path”, params={…})

Parameters:
  • path – path to be called on the service.

  • data – Put data for http request.

  • params – Parameters to pass to the API.

  • headers – Request headers. Defaults to the api headers property.

  • as_json – A boolean to indicate type of response. If True then response will be returned in json format.

  • success_codes – List of http response codes which are treated as success

  • kwargs – Optional arguments that can be passed to requests’ PUT call

Returns:

response from the API.

Raises:

PlatformException – in case of unsuccessful response

class here.platform.service.ServiceConfiguration(json_dict: Dict[str, Any])[source]#

Bases: JsonDictDocument

A JSON document for service configuration used in APIs loaded into a Dict.

Basic fields like name, summary, base_url, logging_url, and tags are provided for reading.

property base_url: str | None#

Base URL in the service config

property logging_url#

Logging URL of the service

property name: str | None#

Name in the service config

property summary: str | None#

Summary in the service config

property tags: List[str]#

List of tags present in the service

property version: str | None#

Version in the service config

class here.platform.service.ServiceHealth(json_dict: Dict[str, Any])[source]#

Bases: JsonDictDocument

A JSON document for service health used in APIs loaded into a Dict.

property status: str#

Health status of the service

class here.platform.service.ServiceVersion(json_dict: Dict[str, Any])[source]#

Bases: JsonDictDocument

A JSON document for service version used in APIs loaded into a Dict.

property api_version: str#

API Version of the service

property data_versions: List[Dict]#

List of data versions in the service

property service_version: str#

Service Version of the service