-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
google.auth.transport.Request is called with type(body) == str #318
Comments
@Nikratio Thank you for reporting this issue. I apologize for the late reply. I clicked on the link https://google-auth.readthedocs.io/en/latest/reference/google.auth.html#google.auth.default, and I don't see a discussion of a body parameter or bytes. Is this issue still reproducible today? Is there another doc that describes the conflict between the docs and the code? |
The link may have changed since the issue was posted:
https://google-auth.readthedocs.io/en/latest/reference/google.auth.transport.html#google.auth.transport.Request Investigation (in progress): google-auth-library-python/google/oauth2/_client.py Lines 83 to 91 in 137b43b
All the public methods that call it specify parameter type google-auth-library-python/google/oauth2/_client.py Lines 118 to 138 in 137b43b
google.auth.transport.Request calls google-auth-library-python/google/auth/transport/requests.py Lines 94 to 124 in 137b43b
|
#421) [`google.auth.transport.Request`](https://google-auth.readthedocs.io/en/latest/reference/google.auth.transport.html#google.auth.transport.Request) says that the body should be of type bytes. Some of our code was passing in strings as reported in #318. In practice this was not causing issues, as the two http transports [requests](https://google-auth.readthedocs.io/en/latest/reference/google.auth.transport.requests.html) and [urllib3](https://google-auth.readthedocs.io/en/latest/reference/google.auth.transport.urllib3.html) are able to handle bodies passed as strings.
According to eg https://google-auth.readthedocs.io/en/latest/reference/google.auth.html#google.auth.default, classes implementing google.auth.transport.Request will be called with a body parameter of type bytes. This makes sense, because the request agent is in no position to decide how a str body should be encoded for transport.
Unfortunately, in some cases the googl.auth module does pass str value. One such call is made in
google-auth-library-python/google/oauth2/_client.py
Line 100 in 137b43b
The text was updated successfully, but these errors were encountered: