I'm trying to use Python3 with requests.post()
but it doesn't return the expected payload, while using CURL (Bash) or Invoke-RestMethod (PwSh) I do get the Token for given account, but with the Python code below is like he's doing a GET instead the POST
request_headers = {'Content-Type': 'application/json'}
request_data = {"description": "AWX CLI Token"}
targeturl =(f"{awx_url}/api/v2/users/{user_id}/personal_tokens")
request = requests.post(targeturl, headers=request_headers, verify=False, data=request_data, auth=(awx_user,awx_pass ))
I've tried also different variations of the request.post()
like using json=json.dumps(request_data)
.
There is no error, return 200.