Python requests 401 Unauthorized on Genesys Cloud OAuth2 Client Credentials

I am trying to write a simple Python script to fetch an access token using the OAuth2 Client Credentials flow. The goal is to automate some API calls for our custom agent desktop integration. I have the client ID and secret, and I am using the requests library. Here is the code snippet I am running:

import requests

url = "https://api.mypurecloud.com/oauth/token"
payload = {
 "grant_type": "client_credentials",
 "client_id": "my-client-id",
 "client_secret": "my-client-secret"
}

response = requests.post(url, data=payload)
print(response.status_code)
print(response.json())

The response is always 401 Unauthorized. The JSON error message says invalid_client. I have double-checked the credentials in the Genesys Cloud Admin UI under Integrations. They look correct. I also tried adding the Content-Type: application/x-www-form-urlencoded header, but it made no difference. Is there something specific about the endpoint or the payload structure that I am missing? I followed the documentation examples, but it seems like the server is rejecting the client ID immediately. Any ideas why this is happening?