Skip to content

Define log var in oauthlib #13794

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

Merged
merged 1 commit into from
Apr 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 23 additions & 21 deletions stubs/oauthlib/oauthlib/oauth1/rfc5849/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
from _typeshed import Incomplete
from typing import Any
from collections.abc import Callable
from logging import Logger
from typing import Any, Final

log: Any
SIGNATURE_HMAC_SHA1: str
SIGNATURE_HMAC_SHA256: str
SIGNATURE_HMAC_SHA512: str
SIGNATURE_HMAC: str
SIGNATURE_RSA_SHA1: str
SIGNATURE_RSA_SHA256: str
SIGNATURE_RSA_SHA512: str
SIGNATURE_RSA: str
SIGNATURE_PLAINTEXT: str
SIGNATURE_METHODS: Any
SIGNATURE_TYPE_AUTH_HEADER: str
SIGNATURE_TYPE_QUERY: str
SIGNATURE_TYPE_BODY: str
CONTENT_TYPE_FORM_URLENCODED: str
log: Logger
SIGNATURE_HMAC_SHA1: Final[str]
SIGNATURE_HMAC_SHA256: Final[str]
SIGNATURE_HMAC_SHA512: Final[str]
SIGNATURE_HMAC: Final[str]
SIGNATURE_RSA_SHA1: Final[str]
SIGNATURE_RSA_SHA256: Final[str]
SIGNATURE_RSA_SHA512: Final[str]
SIGNATURE_RSA: Final[str]
SIGNATURE_PLAINTEXT: Final[str]
SIGNATURE_METHODS: Final[tuple[str, str, str, str, str, str, str]]
SIGNATURE_TYPE_AUTH_HEADER: Final[str]
SIGNATURE_TYPE_QUERY: Final[str]
SIGNATURE_TYPE_BODY: Final[str]
CONTENT_TYPE_FORM_URLENCODED: Final[str]

class Client:
SIGNATURE_METHODS: Any
SIGNATURE_METHODS: dict[str, Callable[[str, Incomplete], str]]
@classmethod
def register_signature_method(cls, method_name, method_callback) -> None: ...
client_key: Any
Expand All @@ -37,8 +39,8 @@ class Client:
timestamp: Any
def __init__(
self,
client_key,
client_secret: Incomplete | None = None,
client_key: str,
client_secret: str | None = None,
resource_owner_key: Incomplete | None = None,
resource_owner_secret: Incomplete | None = None,
callback_uri: Incomplete | None = None,
Expand All @@ -58,7 +60,7 @@ class Client:
self,
uri,
http_method: str = "GET",
body: Incomplete | None = None,
headers: Incomplete | None = None,
body: str | None = None,
headers: dict[str, str] | None = None,
realm: Incomplete | None = None,
): ...
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from _typeshed import Incomplete
from typing import Any
from logging import Logger

from .base import BaseEndpoint as BaseEndpoint

log: Any
log: Logger

class AccessTokenEndpoint(BaseEndpoint):
def create_access_token(self, request, credentials): ...
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from _typeshed import Incomplete
from typing import Any
from logging import Logger

from .base import BaseEndpoint as BaseEndpoint

log: Any
log: Logger

class RequestTokenEndpoint(BaseEndpoint):
def create_request_token(self, request, credentials): ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/oauthlib/oauthlib/oauth1/rfc5849/endpoints/resource.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from _typeshed import Incomplete
from typing import Any
from logging import Logger

from .base import BaseEndpoint as BaseEndpoint

log: Any
log: Logger

class ResourceEndpoint(BaseEndpoint):
def validate_protected_resource_request(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from _typeshed import Incomplete
from typing import Any
from logging import Logger

from .base import BaseEndpoint as BaseEndpoint

log: Any
log: Logger

class SignatureOnlyEndpoint(BaseEndpoint):
def validate_request(
Expand Down
49 changes: 28 additions & 21 deletions stubs/oauthlib/oauthlib/oauth1/rfc5849/signature.pyi
Original file line number Diff line number Diff line change
@@ -1,33 +1,40 @@
from _typeshed import Incomplete
from typing import Any
from _typeshed import Incomplete, Unused
from collections.abc import Iterable
from logging import Logger

log: Any
from oauthlib.common import Request, _HTTPMethod

def signature_base_string(http_method: str, base_str_uri: str, normalized_encoded_request_parameters: str) -> str: ...
log: Logger

def signature_base_string(http_method: _HTTPMethod, base_str_uri: str, normalized_encoded_request_parameters: str) -> str: ...
def base_string_uri(uri: str, host: str | None = None) -> str: ...
def collect_parameters(
uri_query: str = "",
body: Incomplete | None = None,
headers: Incomplete | None = None,
body: str | bytes | dict[str, str] | Iterable[tuple[str, str]] | None = None,
headers: dict[str, str] | None = None,
exclude_oauth_signature: bool = True,
with_realm: bool = False,
): ...
def normalize_parameters(params) -> str: ...
def sign_hmac_sha1_with_client(sig_base_str, client): ...
def verify_hmac_sha1(request, client_secret: Incomplete | None = None, resource_owner_secret: Incomplete | None = None): ...
def sign_hmac_sha1(base_string, client_secret, resource_owner_secret): ...
) -> list[tuple[str, str]]: ...
def normalize_parameters(params: dict[str, str]) -> str: ...
def sign_hmac_sha1_with_client(sig_base_str: str, client): ...
def verify_hmac_sha1(
request: Request, client_secret: Incomplete | None = None, resource_owner_secret: Incomplete | None = None
) -> bool: ...
def sign_hmac_sha1(base_string: str | bytes, client_secret, resource_owner_secret): ...
def sign_hmac_sha256_with_client(sig_base_str, client): ...
def verify_hmac_sha256(request, client_secret: Incomplete | None = None, resource_owner_secret: Incomplete | None = None): ...
def sign_hmac_sha256(base_string, client_secret, resource_owner_secret): ...
def verify_hmac_sha256(
request, client_secret: Incomplete | None = None, resource_owner_secret: Incomplete | None = None
) -> bool: ...
def sign_hmac_sha256(base_string: str | bytes, client_secret, resource_owner_secret): ...
def sign_hmac_sha512_with_client(sig_base_str: str, client): ...
def verify_hmac_sha512(request, client_secret: str | None = None, resource_owner_secret: str | None = None): ...
def sign_rsa_sha1_with_client(sig_base_str, client): ...
def verify_rsa_sha1(request, rsa_public_key: str): ...
def verify_hmac_sha512(request, client_secret: str | None = None, resource_owner_secret: str | None = None) -> bool: ...
def sign_rsa_sha1_with_client(sig_base_str: str | bytes, client): ...
def verify_rsa_sha1(request, rsa_public_key: str) -> bool: ...
def sign_rsa_sha1(base_string, rsa_private_key): ...
def sign_rsa_sha256_with_client(sig_base_str: str, client): ...
def verify_rsa_sha256(request, rsa_public_key: str): ...
def verify_rsa_sha256(request, rsa_public_key: str) -> bool: ...
def sign_rsa_sha512_with_client(sig_base_str: str, client): ...
def verify_rsa_sha512(request, rsa_public_key: str): ...
def sign_plaintext_with_client(_signature_base_string, client): ...
def sign_plaintext(client_secret, resource_owner_secret): ...
def verify_plaintext(request, client_secret: Incomplete | None = None, resource_owner_secret: Incomplete | None = None): ...
def verify_rsa_sha512(request, rsa_public_key: str) -> bool: ...
def sign_plaintext_with_client(_signature_base_string: Unused, client) -> str: ...
def sign_plaintext(client_secret: str | None, resource_owner_secret: str | None) -> str: ...
def verify_plaintext(request, client_secret: str | None = None, resource_owner_secret: str | None = None) -> bool: ...
25 changes: 17 additions & 8 deletions stubs/oauthlib/oauthlib/oauth1/rfc5849/utils.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
UNICODE_ASCII_CHARACTER_SET: str
from collections.abc import Callable, Iterable
from typing import Any, Final, TypeVar

def filter_params(target): ...
def filter_oauth_params(params): ...
def escape(u): ...
def unescape(u): ...
def parse_keqv_list(l): ...
def parse_http_list(u): ...
def parse_authorization_header(authorization_header): ...
_T = TypeVar("_T")

UNICODE_ASCII_CHARACTER_SET: Final[str]

def filter_params(
target: Callable[[dict[str, Any] | Iterable[tuple[str, Any]], _T], object],
) -> Callable[[list[str], _T], object]: ...
def filter_oauth_params(
params: dict[str, Any] | Iterable[tuple[str, Any]],
) -> list[str]: ... # we don't care about second (Any) part
def escape(u: str) -> str: ...
def unescape(u: str) -> str: ...
def parse_keqv_list(l: list[str]) -> dict[str, str]: ...
def parse_http_list(u: str) -> list[str]: ...
def parse_authorization_header(authorization_header: str) -> list[tuple[str, str]]: ...
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from _typeshed import Incomplete
from logging import Logger
from typing import Any

from oauthlib.oauth2.rfc6749.endpoints.base import BaseEndpoint as BaseEndpoint

log: Any
log: Logger

class UserInfoEndpoint(BaseEndpoint):
bearer: Any
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from _typeshed import Incomplete
from logging import Logger
from typing import Any

from .base import GrantTypeBase as GrantTypeBase

log: Any
log: Logger

class AuthorizationCodeGrant(GrantTypeBase):
proxy_target: Any
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from _typeshed import Incomplete
from typing import Any
from logging import Logger

log: Any
log: Logger

class GrantTypeBase:
def __getattr__(self, attr: str): ...
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from _typeshed import Incomplete
from logging import Logger
from typing import Any

log: Any
log: Logger

class Dispatcher:
default_grant: Any
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from _typeshed import Incomplete
from logging import Logger
from typing import Any

from oauthlib.oauth2.rfc6749.errors import InvalidRequestError as InvalidRequestError

from ..request_validator import RequestValidator as RequestValidator
from .base import GrantTypeBase as GrantTypeBase

log: Any
log: Logger

class HybridGrant(GrantTypeBase):
request_validator: Any
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from _typeshed import Incomplete
from logging import Logger
from typing import Any

from .base import GrantTypeBase as GrantTypeBase

log: Any
log: Logger

class ImplicitGrant(GrantTypeBase):
proxy_target: Any
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from _typeshed import Incomplete
from logging import Logger

from .base import GrantTypeBase

log: Incomplete
log: Logger

class RefreshTokenGrant(GrantTypeBase):
proxy_target: Incomplete
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import Any
from logging import Logger

from oauthlib.oauth2.rfc6749.request_validator import RequestValidator as OAuth2RequestValidator

log: Any
log: Logger

class RequestValidator(OAuth2RequestValidator):
def get_authorization_code_scopes(self, client_id, code, redirect_uri, request) -> None: ...
Expand Down