fietsboek.osm module¶
OSM related utilities for fietsboek.
- exception fietsboek.osm.ApiError¶
Bases:
ExceptionBase error class for errors occuring in OSM/Overpass accesses.
- class fietsboek.osm.OverpassApi(interpreter_url)¶
Bases:
objectHelper class to access the overpass API.
This does not really provide a nice interface to use, rather, it takes care of the low-level HTTP fuzz.
- basic_auth(username, password)¶
Sets the HTTP basic auth for this API.
- classmethod from_config(config)¶
Construct an OverpassApi from the given fietsboek config.
- Parameters:
config (
Config) – The config object.- Return type:
- Returns:
The API with correct URL/auth.
- run_script(script)¶
Posts a overpass script to the API and returns the response.
Raises an error if the response is not 200.
- Raises:
ApiTimeout – If the response takes too long.
ApiNotOk – If the response code is not 200.
- Parameters:
script (
str) – The overpass script.- Return type:
Response- Returns:
The response.
- fietsboek.osm.find_name(api, path)¶
Attempt to find a name for the given path.
- Parameters:
api (
OverpassApi) – The overpass API to use.path (
Path) – Path to find a name for.
- Return type:
- Returns:
Name for the path.