I have API like this:
I want to call this API in Python, this is my code :
def get_province():
headers = {
'Content-type': 'application/json',
'x-api-key': api_key
}
response = requests.get(url, headers=headers)
return response.json()
But, I've got
error 500 : Internal Server Error.
I think there's something wrong with the header. Can anyone help me?
Judging from screenshot, it should be Authorization
not x-api-key
i.e.
headers = {
'Content-type': 'application/json',
'Authorization': api_key
}
Please test that and write what is result