'Python requests POST call with OAuth2 token returns 401
I have the following Python function which takes an access_token from my company's access token provider and hits the URL stored in matter_hydration_url:
def hydration_request(access_token, matter_hydration_url):
hydration_call_headers = {'Authorization': 'Bearer ' + access_token}
response = requests.post(matter_hydration_url, headers=hydration_call_headers)
response.raise_for_status()
I have tested BOTH access_token AND matter_hydration_url externally, through POSTMAN, and they both work. Unfortunately, in this code, the response variable has status_code field 401. I think I am mis-using requests.post(). Any ideas?
Solution 1:[1]
Worked after I changed Bearer in the String of line 2 to Access
¯_(?)_/¯
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jason |
