Skip to content

Base HERE API

Base classes shared by HERE API clients.

HEREApi

Base class from which all wrappers inherit.

Source code in src/herepy/here_api.py
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
class HEREApi:
    """Base class from which all wrappers inherit."""

    def __init__(self, api_key: str = None, timeout: int = None):
        """
        Initialize the API client.

        Args:
          api_key (str):
            API key taken from HERE Developer Portal.
          timeout (int):
            Timeout limit for requests.

        """
        self.__set_credentials(api_key)
        if timeout:
            self._timeout = timeout
        else:
            self._timeout = 20

    def __set_credentials(self, api_key):
        """
        Setter for credentials.

        Args:
          api_key (str):
            API key taken from HERE Developer Portal.

        """
        self._api_key = api_key

__init__(api_key=None, timeout=None)

Initialize the API client.

Parameters:

Name Type Description Default
api_key str

API key taken from HERE Developer Portal.

None
timeout int

Timeout limit for requests.

None
Source code in src/herepy/here_api.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
def __init__(self, api_key: str = None, timeout: int = None):
    """
    Initialize the API client.

    Args:
      api_key (str):
        API key taken from HERE Developer Portal.
      timeout (int):
        Timeout limit for requests.

    """
    self.__set_credentials(api_key)
    if timeout:
        self._timeout = timeout
    else:
        self._timeout = 20

__set_credentials(api_key)

Setter for credentials.

Parameters:

Name Type Description Default
api_key str

API key taken from HERE Developer Portal.

required
Source code in src/herepy/here_api.py
25
26
27
28
29
30
31
32
33
34
def __set_credentials(self, api_key):
    """
    Setter for credentials.

    Args:
      api_key (str):
        API key taken from HERE Developer Portal.

    """
    self._api_key = api_key