-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[oauthlib] Fix type on body argument of oauthlib.oauth1.Client.sign() #14295
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
base: main
Are you sure you want to change the base?
Conversation
From the oauthlib documentation: "The body argument may be a dict, a list of 2-tuples, or a formencoded string."
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
One mypy type error remains, caused by an issue in the typeshed type stubs. python/typeshed#14295
def sign( | ||
self, | ||
uri, | ||
http_method: str = "GET", | ||
body: str | dict[str, str] | list[tuple[str, str]] | None = None, | ||
headers: dict[str, str] | None = None, | ||
realm=None, | ||
): ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many of these arguments are forwarded to oauthlib.common.Request
: https://github.com/oauthlib/oauthlib/blob/v3.3.0/oauthlib/oauth1/rfc5849/__init__.py#L295-L296. If you're feeling ambitious, you could align some of the other parameter hints with its signature:
typeshed/stubs/oauthlib/oauthlib/common.pyi
Lines 67 to 74 in ca543bf
def __init__( | |
self, | |
uri: str, | |
http_method: _HTTPMethod = "GET", | |
body: str | dict[str, str] | list[tuple[str, str]] | None = None, | |
headers: Mapping[str, str] | None = None, | |
encoding: str = "utf-8", | |
): ... |
def sign( | ||
self, | ||
uri, | ||
http_method: str = "GET", |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
From the function docstring: "The body argument may be a dict, a list of 2-tuples, or a formencoded string."