Add constants file

This commit is contained in:
coolneng 2020-05-21 18:50:00 +02:00
parent 531671d782
commit 626fc4bfd8
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
2 changed files with 10 additions and 5 deletions

6
app/constants.py Normal file
View File

@ -0,0 +1,6 @@
datasets = [
"coronavirus-commercants-parisiens-livraison-a-domicile"
"deconfinement-pistes-cyclables-temporaires"
"deconfinement-paking-relais-doublement-des-places"
]
url = "https://opendata.paris.fr/api/v2/catalog/datasets/{}/exports/json?rows=-1&pretty=false&timezone=UTC"

View File

@ -1,3 +1,4 @@
from constants import datasets, url
from requests import get
from json import dump
@ -9,14 +10,12 @@ def save_json(data):
def request_dataset(url):
request = get(url)
response = request.json()
response.dump()
data = request.json()
save_json(data)
def main():
url = "https://opendata.paris.fr/api/v2/catalog/datasets/{}/exports/json?rows=-1&pretty=false&timezone=UTC".format(
"deconfinement-pistes-cyclables-temporaires"
)
url.format("deconfinement-pistes-cyclables-temporaires")
if __name__ == "__main__":