Utils module
get_api_key(api_key=None, env_variable_name='GEOAPIFY_KEY')
Simply passes the first argument if not None else returns value of environment variable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_key |
str
|
API key or None. |
None
|
env_variable_name |
str
|
If api_key is None, returns instead the value of the environment variable. |
'GEOAPIFY_KEY'
|
Returns:
Type | Description |
---|---|
str
|
API key as a string. |
Source code in geobatchpy/utils.py
read_data_from_json_file(file_path)
Reads data from a JSON file.
Json = Union[Dict[str, Any], List[Any]] is a superset of the JSON specification, excluding scalar objects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
Union[str, Path]
|
path to the JSON file. |
required |
Returns:
Type | Description |
---|---|
Json
|
The Python equivalent of the JSON object. |
Source code in geobatchpy/utils.py
write_data_to_json_file(data, file_path)
Writes data to a JSON file.
Json = Union[Dict[str, Any], List[Any]] is a superset of the JSON specification, excluding scalar objects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Json
|
an object of Json type. |
required |
file_path |
Union[str, Path]
|
destination path of the JSON file. |
required |