-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python 3.13: an unexpected Authorization
header because of NETRC file
#6928
Comments
This is strange as My best guess is that adding If you check |
Are the versions of requests the same between the two environments as well? |
Can confirm the
Seems to have nothing to do with auth though, but removing this section does fix the issue (similarly setting Since my issue is with another tool that utilizes
Yes. > for i in 3.10 3.13; do echo -n "$i: "; python$i -m requests.help | jq -r '.requests.version'; done
3.10: 2.32.3
3.13: 2.32.3 |
It would be ironic to have an environment variable telling the library to not trust the environment. |
Haha, agree =)) I think I'm just too focused on Looks like my best (and sort of the only) option at the moment is to try and PR to the tool, that I rely upon, a flag to switch Am I right assuming that the Thanks. |
Can you reproduce it just with the standard library? If not, can you write a failing test for https://github.com/psf/requests/blob/main/src%2Frequests%2Futils.py#L207 |
Sorry, I can't seem to figure out what you mean 😕 Isn't the «Reproduction Steps» from the issue description what you're asking about? 🤔 #!/usr/bin/env python3.13
import requests
data = {
"client_id": "0[…]7",
"scope": "openid okta.apps.sso"
}
url = "https://[…].oktapreview.com/oauth2/v1/device/authorize"
headers = {'Accept': 'application/json'}
response = requests.post(url, data=data, headers=headers, verify=True)
print(response.text) > ~/tmp/zzz.py
{"errorCode":"invalid_client","errorSummary":"Invalid value for 'client_id' parameter.","errorLink":"invalid_client","errorId":"oaeohowcwaASwevPhC5oeoeHA","errorCauses":[]}
> NETRC="" ~/tmp/zzz.py
{"device_code":"c[…]f","user_code":"L[…]B","verification_uri":"https://[…].oktapreview.com/activate","verification_uri_complete":"https://[…].oktapreview.com/activate?user_code=L[…]B","expires_in":600,"interval":5}
I could try... though I'm not a Python dev and it can take me a challenge. If you could provide some guidance probably (or point out to an existing test example): I probably need to put a |
Authorization
header because of NETRC file
@sigmavirus24 Any hints? |
When sending POST request using Python 3.13 with
requests
v2.32.3 there appear an unexpectedAuthorization
header.This is not the case with Python 3.10 with the same version of
requests
lib.Expected Result
POST request does not get updated with an unexpected
Authorization
header.Actual Result
Python 3.13
Python 3.10
Reproduction Steps
System Information
Ref: Nike-Inc/gimme-aws-creds#485
The text was updated successfully, but these errors were encountered: