download_from_signals_api

Download all signals from https://api.data.amsterdam.nl/signals

Use ENV for login credentials to use the API:
export DATAPUNT_EMAIL=xxxx export DATAPUNT_PASSWORD=xxxxx
Example command line:
python download_from_signals_api.py https://api.data.amsterdam.nl/signals/auth/signal/?&page_size=1000 SIG/ALL created_at,main_cat,sub_cat,text,address,pc,bc,sd,geometry 1 data sia.json

usage: download_from_signals_api [-h]
                                 url scope params page_limit output_folder
                                 filename

Positional Arguments

url Url of endpoint, for example: https://api.data.amsterdam.nl/signals/auth/signal
scope Specify which scope you have access to as list with no spaces, for example: SIG/ALL,TLLS/R
params Add which fields to extract as a list: created_at,main_cat,sub_cat,text,address,pc,bc,sd,geometry
page_limit number of pages to get, standard 1000 records per page, default all
output_folder Output folder, for example: data
filename name the file with .json

functions

datapunt_processing.extract.download_from_signals_api.get_sia_json(url, scope, params, acc=False, page_limit=0)

first: put SIGNALS_USER en SIGNALS_PASSWORD to env variables (!)

Args:
url: sia api endpoint params: created_at, main_cat, sub_cat, text, address, pc, bc, sd, geometry, status or provide lists/dicts of values bearer_token: bearer_token
Returns:
parsed json or error message
datapunt_processing.extract.download_from_signals_api.parser()

Parser function to run arguments from commandline and to add description to sphinx docs. To see possible styling options: https://pythonhosted.org/an_example_pypi_project/sphinx.html

datapunt_processing.extract.download_from_signals_api.process_address(location)

Extract