Implement dataset request draft

This commit is contained in:
coolneng 2020-05-21 18:45:51 +02:00
parent 3ec2ad16b7
commit 531671d782
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
3 changed files with 24 additions and 16 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
app/__pycache__ app/__pycache__
Design.org

View File

@ -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()

23
app/request_datasets.py Normal file
View File

@ -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()