diff --git a/.gitignore b/.gitignore index 7bb7d67..bfd8bda 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ app/__pycache__ +Design.org diff --git a/app/dummy_request.py b/app/dummy_request.py deleted file mode 100644 index 9e5e3cd..0000000 --- a/app/dummy_request.py +++ /dev/null @@ -1,16 +0,0 @@ -from requests import get - - -def dummy_request(url): - request = get(url) - print(request.text) - - -def main(): - dummy_request( - "https://opendata.paris.fr/api/records/1.0/search/?dataset=velib-disponibilite-en-temps-reel&q=&facet=name&facet=is_installed&facet=is_renting&facet=is_returning&facet=nom_arrondissement_communes" - ) - - -if __name__ == "__main__": - main() diff --git a/app/request_datasets.py b/app/request_datasets.py new file mode 100644 index 0000000..5875ffe --- /dev/null +++ b/app/request_datasets.py @@ -0,0 +1,23 @@ +from requests import get +from json import dump + + +def save_json(data): + with open("cycling-paths.json", "w") as f: + dump(data, f, ensure_ascii=False) + + +def request_dataset(url): + request = get(url) + response = request.json() + response.dump() + + +def main(): + url = "https://opendata.paris.fr/api/v2/catalog/datasets/{}/exports/json?rows=-1&pretty=false&timezone=UTC".format( + "deconfinement-pistes-cyclables-temporaires" + ) + + +if __name__ == "__main__": + main()