OS Data Hub Linked Identifiers API

LinkedIdentifiersAPI

class osdatahub.LinkedIdentifiersAPI.linked_identifiers_api.LinkedIdentifiersAPI(key: str)

Bases: object

Main class for querying the OS Linked Identifiers API (https://osdatahub.os.uk/docs/linkedIdentifiers/overview)

Parameters

key (str) – A valid OS API Key. Get a free key here - https://osdatahub.os.uk/

Example:

from osdatahub import LinkedIdentifiersAPI
from os import environ

key = environ.get("OS_API_KEY")
linked_ids = LinkedIdentifiersAPI(key)
results = linked_ids.query(200001025758)
product_version(correlation_method: str) dict

Discover the current product version information. For a list of valid correlation methods see (https://osdatahub.os.uk/docs/linkedIdentifiers/technicalSpecification)

Parameters
  • correlation_method (str) – Correlation method - corresponding to a

  • relationship (particular feature) –

Returns

The results of the query in JSON format

Return type

dict

query(identifier: Union[int, str], feature_type: str = None, identifier_type: str = None) dict

Run a query of the OS Linked Identifiers API - looks up an identifier and finds its associated identifiers.

Queries can be also be made more specific if the feature type or identifier type are known, but note: you cannot specify both!

Parameters
  • identifier (Union[int, str]) – The identifier to look up.

  • feature_type (str) – Look up linked identifiers when the input feature type is known.

  • identifier_type (str) – Look up linked identifiers when the input identifier type is known.

Returns

The results of the query in JSON format

Return type

dict