mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Add httplib2 third-party stubs (#5713)
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
"stubs/docutils",
|
||||
"stubs/Flask",
|
||||
"stubs/html5lib",
|
||||
"stubs/httplib2",
|
||||
"stubs/Jinja2",
|
||||
"stubs/Markdown",
|
||||
"stubs/Pillow",
|
||||
|
||||
2
stubs/httplib2/@tests/stubtest_allowlist.txt
Normal file
2
stubs/httplib2/@tests/stubtest_allowlist.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
# __getattr__() replaced with actual field in stub
|
||||
httplib2.Response.dict
|
||||
1
stubs/httplib2/METADATA.toml
Normal file
1
stubs/httplib2/METADATA.toml
Normal file
@@ -0,0 +1 @@
|
||||
version = "0.19"
|
||||
186
stubs/httplib2/httplib2/__init__.pyi
Normal file
186
stubs/httplib2/httplib2/__init__.pyi
Normal file
@@ -0,0 +1,186 @@
|
||||
import http.client
|
||||
from collections.abc import Generator
|
||||
from typing import Any, Dict, TypeVar
|
||||
|
||||
from .error import *
|
||||
|
||||
# Should use _typeshed.Self when google/pytype#952 is fixed.
|
||||
Self = TypeVar("Self") # noqa Y001
|
||||
|
||||
__author__: str
|
||||
__copyright__: str
|
||||
__contributors__: list[str]
|
||||
__license__: str
|
||||
__version__: str
|
||||
|
||||
debuglevel: int
|
||||
RETRIES: int
|
||||
|
||||
class Authentication:
|
||||
path: Any
|
||||
host: Any
|
||||
credentials: Any
|
||||
http: Any
|
||||
def __init__(self, credentials, host, request_uri, headers, response, content, http) -> None: ...
|
||||
def depth(self, request_uri): ...
|
||||
def inscope(self, host, request_uri): ...
|
||||
def request(self, method, request_uri, headers, content) -> None: ...
|
||||
def response(self, response, content): ...
|
||||
def __eq__(self, auth): ...
|
||||
def __ne__(self, auth): ...
|
||||
def __lt__(self, auth): ...
|
||||
def __gt__(self, auth): ...
|
||||
def __le__(self, auth): ...
|
||||
def __ge__(self, auth): ...
|
||||
def __bool__(self): ...
|
||||
|
||||
class BasicAuthentication(Authentication):
|
||||
def __init__(self, credentials, host, request_uri, headers, response, content, http) -> None: ...
|
||||
def request(self, method, request_uri, headers, content) -> None: ...
|
||||
|
||||
class DigestAuthentication(Authentication):
|
||||
challenge: Any
|
||||
A1: Any
|
||||
def __init__(self, credentials, host, request_uri, headers, response, content, http) -> None: ...
|
||||
def request(self, method, request_uri, headers, content, cnonce: Any | None = ...): ...
|
||||
def response(self, response, content): ...
|
||||
|
||||
class HmacDigestAuthentication(Authentication):
|
||||
challenge: Any
|
||||
hashmod: Any
|
||||
pwhashmod: Any
|
||||
key: Any
|
||||
def __init__(self, credentials, host, request_uri, headers, response, content, http) -> None: ...
|
||||
def request(self, method, request_uri, headers, content) -> None: ...
|
||||
def response(self, response, content): ...
|
||||
|
||||
class WsseAuthentication(Authentication):
|
||||
def __init__(self, credentials, host, request_uri, headers, response, content, http) -> None: ...
|
||||
def request(self, method, request_uri, headers, content) -> None: ...
|
||||
|
||||
class GoogleLoginAuthentication(Authentication):
|
||||
Auth: str
|
||||
def __init__(self, credentials, host, request_uri, headers, response, content, http) -> None: ...
|
||||
def request(self, method, request_uri, headers, content) -> None: ...
|
||||
|
||||
class FileCache:
|
||||
cache: Any
|
||||
safe: Any
|
||||
def __init__(self, cache, safe=...) -> None: ...
|
||||
def get(self, key): ...
|
||||
def set(self, key, value) -> None: ...
|
||||
def delete(self, key) -> None: ...
|
||||
|
||||
class Credentials:
|
||||
credentials: Any
|
||||
def __init__(self) -> None: ...
|
||||
def add(self, name, password, domain: str = ...) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def iter(self, domain) -> Generator[tuple[str, str], None, None]: ...
|
||||
|
||||
class KeyCerts(Credentials):
|
||||
def add(self, key, cert, domain, password) -> None: ... # type: ignore
|
||||
def iter(self, domain) -> Generator[tuple[str, str, str], None, None]: ... # type: ignore
|
||||
|
||||
class AllHosts: ...
|
||||
|
||||
class ProxyInfo:
|
||||
bypass_hosts: Any
|
||||
def __init__(
|
||||
self,
|
||||
proxy_type,
|
||||
proxy_host,
|
||||
proxy_port,
|
||||
proxy_rdns: bool = ...,
|
||||
proxy_user: Any | None = ...,
|
||||
proxy_pass: Any | None = ...,
|
||||
proxy_headers: Any | None = ...,
|
||||
) -> None: ...
|
||||
def astuple(self): ...
|
||||
def isgood(self): ...
|
||||
def applies_to(self, hostname): ...
|
||||
def bypass_host(self, hostname): ...
|
||||
|
||||
class HTTPConnectionWithTimeout(http.client.HTTPConnection):
|
||||
proxy_info: Any
|
||||
def __init__(self, host, port: Any | None = ..., timeout: Any | None = ..., proxy_info: Any | None = ...) -> None: ...
|
||||
sock: Any
|
||||
def connect(self) -> None: ...
|
||||
|
||||
class HTTPSConnectionWithTimeout(http.client.HTTPSConnection):
|
||||
disable_ssl_certificate_validation: Any
|
||||
ca_certs: Any
|
||||
proxy_info: Any
|
||||
key_file: Any
|
||||
cert_file: Any
|
||||
key_password: Any
|
||||
def __init__(
|
||||
self,
|
||||
host,
|
||||
port: Any | None = ...,
|
||||
key_file: Any | None = ...,
|
||||
cert_file: Any | None = ...,
|
||||
timeout: Any | None = ...,
|
||||
proxy_info: Any | None = ...,
|
||||
ca_certs: Any | None = ...,
|
||||
disable_ssl_certificate_validation: bool = ...,
|
||||
tls_maximum_version: Any | None = ...,
|
||||
tls_minimum_version: Any | None = ...,
|
||||
key_password: Any | None = ...,
|
||||
) -> None: ...
|
||||
sock: Any
|
||||
def connect(self) -> None: ...
|
||||
|
||||
class Http:
|
||||
proxy_info: Any
|
||||
ca_certs: Any
|
||||
disable_ssl_certificate_validation: Any
|
||||
tls_maximum_version: Any
|
||||
tls_minimum_version: Any
|
||||
connections: Any
|
||||
cache: Any
|
||||
credentials: Any
|
||||
certificates: Any
|
||||
authorizations: Any
|
||||
follow_redirects: bool
|
||||
redirect_codes: Any
|
||||
optimistic_concurrency_methods: Any
|
||||
safe_methods: Any
|
||||
follow_all_redirects: bool
|
||||
ignore_etag: bool
|
||||
force_exception_to_status_code: bool
|
||||
timeout: Any
|
||||
forward_authorization_headers: bool
|
||||
def __init__(
|
||||
self,
|
||||
cache: Any | None = ...,
|
||||
timeout: Any | None = ...,
|
||||
proxy_info=...,
|
||||
ca_certs: Any | None = ...,
|
||||
disable_ssl_certificate_validation: bool = ...,
|
||||
tls_maximum_version: Any | None = ...,
|
||||
tls_minimum_version: Any | None = ...,
|
||||
) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def add_credentials(self, name, password, domain: str = ...) -> None: ...
|
||||
def add_certificate(self, key, cert, domain, password: Any | None = ...) -> None: ...
|
||||
def clear_credentials(self) -> None: ...
|
||||
def request(
|
||||
self,
|
||||
uri,
|
||||
method: str = ...,
|
||||
body: Any | None = ...,
|
||||
headers: Any | None = ...,
|
||||
redirections=...,
|
||||
connection_type: Any | None = ...,
|
||||
): ...
|
||||
|
||||
class Response(Dict[str, Any]):
|
||||
fromcache: bool
|
||||
version: int
|
||||
status: int
|
||||
reason: str
|
||||
previous: Any
|
||||
def __init__(self, info) -> None: ...
|
||||
@property
|
||||
def dict(self: Self) -> Self: ...
|
||||
15
stubs/httplib2/httplib2/auth.pyi
Normal file
15
stubs/httplib2/httplib2/auth.pyi
Normal file
@@ -0,0 +1,15 @@
|
||||
from typing import Any
|
||||
|
||||
UNQUOTE_PAIRS: Any
|
||||
unquote: Any
|
||||
tchar: Any
|
||||
token: Any
|
||||
token68: Any
|
||||
quoted_string: Any
|
||||
auth_param_name: Any
|
||||
auth_param: Any
|
||||
params: Any
|
||||
scheme: Any
|
||||
challenge: Any
|
||||
authentication_info: Any
|
||||
www_authenticate: Any
|
||||
9
stubs/httplib2/httplib2/certs.pyi
Normal file
9
stubs/httplib2/httplib2/certs.pyi
Normal file
@@ -0,0 +1,9 @@
|
||||
from typing import Any
|
||||
|
||||
certifi_available: bool
|
||||
certifi_where: Any
|
||||
custom_ca_locater_available: bool
|
||||
custom_ca_locater_where: Any
|
||||
BUILTIN_CA_CERTS: Any
|
||||
|
||||
def where(): ...
|
||||
18
stubs/httplib2/httplib2/error.pyi
Normal file
18
stubs/httplib2/httplib2/error.pyi
Normal file
@@ -0,0 +1,18 @@
|
||||
from typing import Any
|
||||
|
||||
class HttpLib2Error(Exception): ...
|
||||
|
||||
class HttpLib2ErrorWithResponse(HttpLib2Error):
|
||||
response: Any
|
||||
content: Any
|
||||
def __init__(self, desc, response, content) -> None: ...
|
||||
|
||||
class RedirectMissingLocation(HttpLib2ErrorWithResponse): ...
|
||||
class RedirectLimit(HttpLib2ErrorWithResponse): ...
|
||||
class FailedToDecompressContent(HttpLib2ErrorWithResponse): ...
|
||||
class UnimplementedDigestAuthOptionError(HttpLib2ErrorWithResponse): ...
|
||||
class UnimplementedHmacDigestAuthOptionError(HttpLib2ErrorWithResponse): ...
|
||||
class MalformedHeader(HttpLib2Error): ...
|
||||
class RelativeURIError(HttpLib2Error): ...
|
||||
class ServerNotFoundError(HttpLib2Error): ...
|
||||
class ProxiesUnavailableError(HttpLib2Error): ...
|
||||
12
stubs/httplib2/httplib2/iri2uri.pyi
Normal file
12
stubs/httplib2/httplib2/iri2uri.pyi
Normal file
@@ -0,0 +1,12 @@
|
||||
from typing import Any
|
||||
|
||||
__author__: str
|
||||
__copyright__: str
|
||||
__contributors__: list[str]
|
||||
__version__: str
|
||||
__license__: str
|
||||
|
||||
escape_range: Any
|
||||
|
||||
def encode(c): ...
|
||||
def iri2uri(uri): ...
|
||||
42
stubs/httplib2/httplib2/socks.pyi
Normal file
42
stubs/httplib2/httplib2/socks.pyi
Normal file
@@ -0,0 +1,42 @@
|
||||
import socket
|
||||
from typing import Any
|
||||
|
||||
PROXY_TYPE_SOCKS4: int
|
||||
PROXY_TYPE_SOCKS5: int
|
||||
PROXY_TYPE_HTTP: int
|
||||
PROXY_TYPE_HTTP_NO_TUNNEL: int
|
||||
|
||||
class ProxyError(Exception): ...
|
||||
class GeneralProxyError(ProxyError): ...
|
||||
class Socks5AuthError(ProxyError): ...
|
||||
class Socks5Error(ProxyError): ...
|
||||
class Socks4Error(ProxyError): ...
|
||||
class HTTPError(ProxyError): ...
|
||||
|
||||
def setdefaultproxy(
|
||||
proxytype: Any | None = ...,
|
||||
addr: Any | None = ...,
|
||||
port: Any | None = ...,
|
||||
rdns: bool = ...,
|
||||
username: Any | None = ...,
|
||||
password: Any | None = ...,
|
||||
) -> None: ...
|
||||
def wrapmodule(module) -> None: ...
|
||||
|
||||
class socksocket(socket.socket):
|
||||
def __init__(self, family=..., type=..., proto: int = ..., _sock: Any | None = ...) -> None: ...
|
||||
def sendall(self, content, *args): ...
|
||||
def setproxy(
|
||||
self,
|
||||
proxytype: Any | None = ...,
|
||||
addr: Any | None = ...,
|
||||
port: Any | None = ...,
|
||||
rdns: bool = ...,
|
||||
username: Any | None = ...,
|
||||
password: Any | None = ...,
|
||||
headers: Any | None = ...,
|
||||
) -> None: ...
|
||||
def getproxysockname(self): ...
|
||||
def getproxypeername(self): ...
|
||||
def getpeername(self): ...
|
||||
def connect(self, destpair) -> None: ...
|
||||
Reference in New Issue
Block a user