Issues With Getting a Bearer Token

The cmd line in the getting starting guide is not working for me. Does anyone have versions of this code in R or Python?

thanks

Some of the guide examples aren’t correct anymore. I’d recommend using the Postman examples, as they’re updated and you can export to Python

For the bearer token I use the following, with my public and secret keys as string variables:
url = ‘https://api.tcgplayer.com/token
payload = ‘grant_type=client_credentials&client_id=’+ public +’&client_secret=’+ secret
headers = {‘Content-Type’: ‘application/json’}
response = requests.request(‘POST’, url, headers=headers, data = payload)
bearer_token = json.loads(response.text)[‘access_token’]