Created
October 22, 2022 14:39
-
-
Save liorazi/f3036f3641712c6e8bdcbe4ca93bedc6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
URL = "https://data.gov.il/api/3/action/datastore_search?resource_id=c8b9f9c8-4612-4068-934f-d4acd2e3c06e" | |
plate_filled = plate.zfill(8) | |
dictionary = { | |
"MISPAR RECHEV": plate_filled | |
} | |
json_object = json.dumps(dictionary, indent=4) | |
PARAMS = {'filters': json_object} | |
r = requests.get(url=URL, params=PARAMS) | |
data = r.json() | |
data_dict = data['result']['records'][-1] | |
total_url = "https://data.gov.il/api/3/action/datastore_search?resource_id=c8b9f9c8-4612-4068-934f-d4acd2e3c06e&include_total=true" | |
r = requests.get(url=total_url) | |
total_data = r.json() | |
total = total_data['result']['total'] | |
result_array = [{ | |
"tag_creation_date": data_dict["TAARICH HAFAKAT TAG"], | |
"tag_type": data_dict["SUG TAV"], | |
"total": total | |
}] | |
# Serializing json | |
json_object = json.dumps(result_array, indent=4) | |
response = Response(json_object, content_type="application/json; charset=utf-8") | |
return response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment