Python requests 401 on Genesys Cloud OAuth client creds

Trying to get access token with client credentials flow using Python requests. Getting 401 Unauthorized. Code:

import requests
url = 'https://api.mypurecloud.com/oauth/token'
payload = {'grant_type': 'client_credentials', 'client_id': 'my_client_id', 'client_secret': 'my_secret'}
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
r = requests.post(url, data=payload, headers=headers)
print(r.status_code, r.text)

Using correct client id and secret from dev console. Token endpoint is correct. Why am I getting 401?