I am looking for a way to do this with a Python script:
curl -X POST -d '{"username": "user","password": "password","scopes": ["download"]}' https://api.fakedomain.com/v2.0/oauth/token
When I execute this from a linux command line, it outputs a client access token. I am trying to make this work through a Python script. I have tried the following:
import requests
url = 'https://api.fakedomain.com/v2.0/oauth/token'
creds = {"username": "<user>",
"password": "<password>",
"scopes": ["download"]}
r = requests.post(url, data=creds)
print(r.text)
The script completes with exit code 0, but I can't find the access token anywhere. Any ideas would be greatly appreciated.