here.platform.platform module#
HERE platform module
- class here.platform.platform.Platform(credentials: PlatformCredentials | None = None, application_config: ApplicationConfig | None = None, environment: Environment | None = None, proxies: dict | None = None, billing_tag: str | None = None, adapter: Adapter | None = None, project_hrn: str | None = None, platform_config: PlatformConfig | None = None)[source]#
Bases:
objectThis class is responsible for interacting with the HERE platform.
It requires PlatformCredentials, ApplicationConfig, Environment and proxies configuration. If not provided, there are defined using default values or standard configuration files.
- property aaa_auth_api: AAAAuthorizationApi#
Lazy loads the service AAAAuthorization API.
This API is not implemented in the Local Data Service.
- Returns:
AAAAuthorization instance.
- property artifact_api: ArtifactApi#
Lazy loads the service Artifact API.
- Returns:
ArtifactApi instance.
- catalog_exists(hrn: str) bool[source]#
Check whether a catalog with the specified HRN exists.
- Parameters:
hrn – a HERE Resource Name
- Returns:
a boolean value indicating if a catalog exists
- clone_catalog(source: Catalog, id: str, name: str | None = None, summary: str | None = None, description: str | None = None, billing_tag: str | None = None, layers: List | None = None)[source]#
Create a catalog from a source catalog and return a
Catalogobject. Cloning will be restricted to configuration. No data will be cloned or copied from source to new catalog.- Parameters:
source – Catalog object from which new catalog need to be cloned.
id – An identifier unique within the realm, used to construct the catalog HRN
name – The short name for the catalog
summary – A one-sentence summary of the catalog
description – A detailed description of the catalog and what it contains
billing_tag – A string to represent a grouping of billing records. If None, platform billing tag will be used,if present.
layers – A list of layer ids to be added in clone catalog. These layer ids must be present in source catalog. If None, all layers present in source catalog will be copied.
- Returns:
a
Catalogobject
- create_catalog(id: str, name: str, summary: str, description: str, billing_tag: str | None = None, **details) Catalog[source]#
Create a catalog and return a
Catalogobject for the given metadata.- Parameters:
id – An identifier unique within the realm, used to construct the catalog HRN
name – The short name for the catalog
summary – A one-sentence summary of the catalog
description – A detailed description of the catalog and what it contains
details – Optional catalog details - tags, layers, version, notifications and replication. See the documentation for the catalog configuration for more informations
billing_tag – A string to represent a grouping of billing records. If None, platform billing tag will be used,if present.
- Returns:
a
Catalogobject
Usage:
>>> from here.platform import Platform >>> platform = Platform() >>> catalog = platform.create_catalog(id="create-catalog", name="name", summary="summary", description="description", tags=["tag1", "tag2"])
- create_project(project_id: str, project_name: str, project_desc: str) Project[source]#
Create a project.
- Parameters:
project_id – A unique id for the project.
project_name – The short name for the project.
project_desc – A detailed description of the project and what it contains.
- Returns:
a :class ‘Project’ object.
Usage:
>>> from here.platform import Platform >>> platform = Platform() >>> project = platform.create_project(id="create-project", name="name", >>> description="description")
- property data_config_api: DataConfigApi#
Lazy loads the service DataConfig API.
- Returns:
DataConfigApi instance.
- delete_artifact(artifact_hrn: str, force: bool | None = None) bool[source]#
Delete the artifact and related files by given HRN.
- Parameters:
artifact_hrn – The HRN of the schema.
force – The flag to force the deletion even if the artifact is linked to a project. By default force flag is set to false.
- Returns:
response from the API.
- delete_catalog(hrn: str)[source]#
Delete a catalog along with the layers it contains.
- Parameters:
hrn – the HERE Resource Name of the catalog
Usage:
>>> from here.platform import Platform >>> platform = Platform() >>> platform.delete_catalog("hrn:here:data::olp-here:delete")
- delete_project(hrn: str)[source]#
Delete a project along with the catalogs it contains.
- Parameters:
hrn – HRN identifying the project
- delete_schema(schema_hrn: str) bool[source]#
Delete the schema and related artifacts by given HRN.
- Parameters:
schema_hrn – The HRN of the schema.
- Returns:
response from the API.
- property environment: Environment#
Return the platform environment.
- Returns:
environment
- Return type:
- get_all_subscriptions(limit: int | None = None) Iterator[InteractiveMapSubscription][source]#
Lists all subscriptions that your account has access to.
- Parameters:
limit – number of records to limit per fetch.
- Yields:
A :List of InteractiveMapSubscription class object
- get_artifact(artifact_hrn: str) Artifact[source]#
Return the information about artifact (hrn, groupId, artifactId, version) and linked files.
- Parameters:
artifact_hrn – The HRN of the artifact.
- Returns:
response from the API.
- get_catalog(hrn: str, adapter: Adapter | None = None, billing_tag: str | None = None) Catalog[source]#
Return a
Catalogobject for the given HRN.- Parameters:
hrn – a string representing a HERE Resource Name.
adapter – the
Adapterto transform data between different representations. The platform adapter is used caseNoneis specified.billing_tag – A string to represent a grouping of billing records. If None, platform billing tag will be used,if present.
- Returns:
Catalogobject- Raises:
ValueError – if the catalog does not exist or credentials don’t provide access to it
Usage:
>>> from here.platform import Platform >>> platform = Platform() >>> platform.get_catalog("hrn:here:data::olp-here:oma-3") <here.platform.catalog.Catalog object at 0x...>
- get_map_matcher_map_version(version: str = 'latest') MapMatcher[source]#
Gets information for a specific map matcher map version :param version: map version to use or latest to use the latest available version :return: a
MapMatcherobject
- get_project(hrn: str) Project[source]#
Return a
Projectobject for the given HRN.- Parameters:
hrn – a string representing a HERE Resource Name.
- Returns:
the Project.
Usage:
>>> from here.platform import Platform >>> platform = Platform() >>> platform.get_project("hrn:here:authorization::olp-here:project/test")
- get_schema(schema_hrn: str) Schema[source]#
Return the information about schema (hrn, groupId, artifactId, version) and related artifact and variants for the given HRN.
- Parameters:
schema_hrn – The HRN of the schema.
- Returns:
response from the API.
- get_service(hrn: str) Service[source]#
Return a
Serviceobject for the given HRN.- Parameters:
hrn – a string representing a HERE Resource Name.
- Returns:
Serviceobject
Usage:
>>> from here.platform import Platform >>> platform = Platform() >>> platform.get_service("hrn:here:service::olp-here:routing-8") <here.platform.service.Service object at 0x...>
- get_status(as_type='json', event_type='incident')[source]#
Get platform status
- Parameters:
as_type – format of the response
event_type – type of event
- Returns:
Platform status in the desired format
- Raises:
ValueError – Incorrect parameter value
- get_subscription(subscription_hrn: str) InteractiveMapSubscription[source]#
To get configuration of the subscription associated with the HRN.
- Parameters:
subscription_hrn – The HERE Resource Name (HRN) of subscription
- Returns:
InteractiveMapSubscription object.
- leave_project(hrn: str)[source]#
Remove the caller from the specified Project.
- Parameters:
hrn – HRN identifying the project
Usage:
>>> from here.platform import Platform >>> platform = Platform() >>> platform.leave_project("hrn:here:authorization::"
“olp-here:project/test”) # doctest: +SKIP
- list_artifacts(access: AccessType | None = None, sort: str | None = None, order: str | None = None, from_param: str | None = None, group_id: str | None = None, artifact_id: str | None = None, limit: int | None = None, offset: int | None = None) List[Artifact][source]#
List all the artifacts accessible on the HERE platform.
- Parameters:
access – Comma separated list of access types (with OR semantic) to filter result. If ‘default’, returns artifacts user has read access to. If ‘orgAdmin’, returns artifacts OrgAdmin user have access to.
sort – sort parameter
order – order of sorting. Available values : ASC, DESC
from_param – from parameter
group_id – Applies filtering based on groupId
artifact_id – Applies filtering based on artifactId
limit – limit number of records
offset – offset number of records
- Returns:
response from the API.
- list_catalogs(**filters: str) List[Catalog][source]#
List all the catalogs accessible on the HERE platform.
Optionally, search and return only catalogs specified by some filter criteria. It does not return catalog that credentials don’t provide access to.
- Parameters:
filters – keywords to search for
- Returns:
a list of
Catalogobjects
Usage:
>>> from here.platform import Platform >>> platform = Platform() >>> platform.list_catalogs(coverage="CN") [<here.platform.catalog.Catalog object at ...]
- list_layer_details(**filters: str) List[dict][source]#
List all the layer details accessible on the HERE platform.
Optionally, search and return only layers specified by some filter criteria. It does not return layers that credentials don’t provide access to.
- Parameters:
filters – keywords to search for
- Returns:
list of layer details
Usage:
>>> from here.platform import Platform >>> import pandas as pd >>> platform = Platform() >>> layers = platform.list_layer_details(coverage='US')
- list_layers(**filters: str) List[Layer][source]#
List all the layer details accessible on the HERE platform.
Optionally, search and return only layers specified by some filter criteria. It does not return layers that credentials don’t provide access to.
- Parameters:
filters – keywords to search for
- Returns:
dataframe with layer details
Usage:
>>> from here.platform import Platform >>> import pandas as pd >>> platform = Platform() >>> layer_df = platform.list_layers(coverage='US')
- list_projects(limit: int | None = None, can_manage: bool | None = None, is_member: bool | None = None) List[Project][source]#
Get the list of projects that you are a project admin or a member based on the can_manage and is_member.
- Parameters:
limit – Number of entries to be returned in the response
can_manage – If true returns all projects of which the caller(user/app) is a project admin
is_member – If true returns all projects of which the caller(user/app) is a member
- Returns:
a list of projects.
Usage:
>>> from here.platform import Platform >>> platform = Platform() >>> resp = platform.list_projects(limit=10)
- list_schemas(access: str | None = None, sort: str | None = None, order: str | None = None, from_param: str | None = None, group_id: str | None = None, artifact_id: str | None = None, limit: int | None = None, offset: int | None = None) List[Schema][source]#
Return the list of available schemas.
- Parameters:
access – Comma separated list of access types (with OR semantic) to filter result. If ‘default’, returns schema user have read access to. If ‘orgAdmin’, returns catalogs OrgAdmin user have access to.
sort – sort parameter
order – order of sorting
from_param – from parameter
group_id – Applies filtering based on groupId
artifact_id – Applies filtering based on artifactId
limit – limit number of records
offset – offset number of records
- Returns:
response from the API.
- list_services() List[Service][source]#
List all the services accessible on the HERE platform.
- Returns:
a list of
Serviceobjects
Usage:
>>> from here.platform import Platform >>> platform = Platform() >>> platform.list_services() [<here.platform.service.Service object at ...]
- map_matcher_map_versions() List[MapMatcher][source]#
List all available map matcher map versions
- property map_matching_api: MapMatchingApi#
Lazy loads the service registry API.
This API is not implemented in the Local Data Service.
- Returns:
ServiceRegistryApi instance.
- modify_catalog(hrn: str, **details)[source]#
Modify the catalog details, including name, summary, description.
This replaces the complete details of the catalog.
After this call succeedes, obtain a new catalog via get_catalog to have access to the modified details, including affected layers.
- Parameters:
hrn – the HERE Resource Name of the catalog
details – Optional catalog details - tags, layers, version, notifications and replication. See the documentation for the catalog configuration for more informations.
The documentation for the API endpoint used can be found here: Modify a Catalog # noqa E501
Usage:
>>> from here.platform import Platform >>> platform = Platform() >>> platform.modify_catalog(hrn="hrn:here:data::olp-here:update", name='updated-name', description='updated-description')
- property platform_config: PlatformConfig#
Return the platform config.
- Returns:
Platform configuration
- Return type:
- property schema_registry: SchemaRegistry#
Lazy loads the service SchemaRegistry API.
- Returns:
singleton SchemaRegistry instance.
- property service_registry_api: ServiceRegistryApi#
Lazy loads the service registry API.
This API is not implemented in the Local Data Service.
- Returns:
ServiceRegistryApi instance.
- subscribe(subscription_name: str, description: str, source_catalog_hrn: str, source_layer: str, destination_catalog_hrn: str, destination_layer_id: str, interactive_map_subscription_type: InteractiveMapSubscriptionType) InteractiveMapSubscription[source]#
Method to Subscribe to a Stream Layer from Layer’s Catalog HRN. Source Layer is the current layer and Source Catalog is Layer’s Catalog which it belongs.
- Parameters:
subscription_name – Name of the subscription.
description – Description of the subscription.
source_catalog_hrn – Catalog HRN of the source Catalog.
source_layer – Layer id of the source Interactive Map Layer.
destination_catalog_hrn – Catalog HRN of the destination Catalog.
destination_layer_id – Layer id of the destination Stream Layer.
interactive_map_subscription_type – InteractiveMapSubscriptionType containing type of
subscription. :raises KeyError: in case statusToken in Response of createSubscription. :raises ValueError: in case Created Subscription Status is NOT Active after
multiple retry till max retry time.
- Returns:
InteractiveMapSubscription object containing details of the created subscription.
- subscription_exists(subscription_hrn: str) bool[source]#
Checks whether a subscription with the specified HRN exists.
- Parameters:
subscription_hrn – The HERE Resource Name (HRN) of subscription
- Returns:
True if subscription exists.
- subscription_status(status_token: str) InteractiveMapSubscriptionStatus[source]#
Get the status of the subscription.
- Parameters:
status_token – Status token from create/delete subscription response.
- Returns:
InteractiveMapSubscriptionStatus object containing status.
- unsubscribe(subscription_hrn: str) InteractiveMapUnsubscribe[source]#
Deletes a subscription associated with the HRN.
- Parameters:
subscription_hrn – The HERE Resource Name (HRN) of subscription.
- Returns:
InteractiveMapUnsubscribe object containing details.
- update_catalog(hrn: str, name: str | None = None, summary: str | None = None, description: str | None = None, new_layers: List[Dict] | None = None, **details)[source]#
Update the catalog details.
This replaces the complete details of the catalog.
After this call succeedes, obtain a new catalog via get_catalog to have access to the updated details, including affected layers.
- Parameters:
hrn – the HERE Resource Name of the catalog
name – the optional new short name of the catalog.
summary – the optional new summary of the catalog.
description – the optional new detailed description of the catalog.
new_layers – the optional list of new layers - each new layer needs to be a dict For the format please see the documentation for the catalog configuration. Please note that layers can only be added to the catalog using this function.
details – Optional catalog details - tags, version, notifications and replication. See the documentation for the catalog configuration for more information.
The documentation for the API endpoint used can be found here: Updates a Catalog # noqa E501
Usage:
>>> from here.platform import Platform >>> platform = Platform() >>> new_layer = {} # put the configuration of a new layer here as a dict >>> platform.update_catalog(hrn='hrn:here:data::olp-here:update', name='updated', new_layers=[new_layer])