Python requests OAuth2 Client Credentials returning 401 in Sydney region

Trying to script a simple auth flow using Python requests for our Sydney region tenant. I’m hitting the standard token endpoint with the client credentials grant type, but I keep getting a 401 Unauthorized. The client ID and secret are definitely correct since they work in Postman, but the Python script fails every time.

Here is the snippet I’m using. Is the header format wrong or am I missing something obvious with the region-specific endpoint?

import requests
url = "https://api.us.genesys.cloud/oauth/token"
data = {"grant_type": "client_credentials"}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
auth = (client_id, client_secret)
response = requests.post(url, data=data, headers=headers, auth=auth)
print(response.status_code)

The region parameter goes in the host, not the path, so make sure you’re hitting https://api.euc1.genesyscloud.com for Sydney. If that’s right, check that your Content-Type is application/x-www-form-urlencoded and the body is grant_type=client_credentials&client_id=...&client_secret=....