I have the following issue: I am trying to execute the code:
import requests
import json
url = 'https://data.gov.gr/api/v1/query/mdg_emvolio?date_from=2021-01-07&date_to=2021-01-14'
headers = {'Authorization':'Token xxxxxxxxxxxxxx’}
response = requests.get(url, headers=headers)
json_object = json.loads(response.text)
json_formatted_str = json.dumps(json_object, indent=2)
print(json_formatted_str)
I want the output to be nice formatted in json, but the Greek characters do not appear correctly. I get the following output (a part of):
{
"area": "\u0391\u0399\u03a4\u03a9\u039b\u039f\u0391\u039a\u0391\u03a1\u039d\u0391\u039d\u0399\u0391\u03a3",
"areaid": 701,
"daydiff": 10,
"daytotal": 60,
"referencedate": "2021-01-07T00:00:00",
"totaldistinctpersons": 210,
"totalvaccinations": 210
},
On the other hand, if I use:
print (response.json())
I get correct Greek characters but (as expected), no nice as for example the following:
{'area': 'ΑΙΤΩΛΟΑΚΑΡΝΑΝΙΑΣ', 'areaid': 701, 'daydiff': 10, 'daytotal': 60, 'referencedate': '2021-01-07T00:00:00', 'totaldistinctpersons': 210, 'totalvaccinations': 210},
Any ideas?