I am trying to convert the following curl command to Python request command:
curl 'https://api.test.com/v1/data/?type=name&status=active' -H 'Authorization: apikey username:api_key_value'
I have tried a lot of possible solutions like the one below but nothing is working and I am getting a'401' code:
url = "https://api.test.com/v1/data/?type=name&status=active"
headers = {"content-type": "application/json", "Accept-Charset": "UTF-8"}
params = (
(username, api_key_value),
)
data = requests.get(url, headers=headers, params=params).json
print(data)