-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add urllib3.contrib.socks
; improve urllib3.connectionpool
#8457
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
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
1232e08
fix: Add urllib3.contrib.socks types
56565eb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 33e7aa9
fix: optional syntax
ed27153
fix: use collections.abc instead of typing
bff6e4f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 5bebd34
fix: add missing dependency and remove `Any`
78858c8
fix: remove unused import
aadbe4f
Remove private _new_conn
2bf6fb2
Fix incorrect use of `HTTPS` when should be `HTTP`
ef2f122
Fix do not use `ClassVar` as it's overridden on instances
fc92c1e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] daf1115
fix: various declarations in urllib3.connectionpool
c283533
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 82952d1
Fix flake8
AlexWaygood ced3693
fix: correct ConnectionCls on SOCKS connection pools
00e4f7b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 7faefda
fix flake8 again
AlexWaygood 397d9f2
Merge branch 'master' into refactor/urllib3-socks
AlexWaygood d8d8d0b
fix: add stubtest allowlist entry with todo comment
2b94314
fix: add second stubtest ignore with second todo comment for clarity
5642cab
fix: __exit__ method signature
4180301
fix: Use LifoQueue from .util.queue
2c0dc2a
fix: various bugs with specifics in urllib3
57e975d
Merge branch 'master' into refactor/urllib3-socks
5a2f486
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] d4ef0ff
fix: use SOCKSHTTPSConnection rather than SOCKSHTTPConnection
3799ea3
fix: stubtest error
f951a3e
fix: move typing.Literal to typing_extensions.Literal
322b30f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 834417b
fix: use type[LifoQueue] instead of ClassVar[LifoQueue]
3e231f4
refactor: update ConnectionPool.LifoQueue to ClassVar[type[queue.Queu…
5441d50
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 20ce0e2
fix: rename LifoQueue import
a17c253
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PySocks>=1.5.6,<2.0,!=1.5.7 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from collections.abc import Mapping | ||
from typing import ClassVar | ||
from typing_extensions import TypedDict | ||
|
||
from ..connection import HTTPConnection, HTTPSConnection | ||
from ..connectionpool import HTTPConnectionPool, HTTPSConnectionPool | ||
from ..poolmanager import PoolManager | ||
|
||
class _TYPE_SOCKS_OPTIONS(TypedDict): | ||
socks_version: int | ||
proxy_host: str | None | ||
proxy_port: str | None | ||
username: str | None | ||
password: str | None | ||
rdns: bool | ||
|
||
class SOCKSConnection(HTTPConnection): | ||
def __init__(self, _socks_options: _TYPE_SOCKS_OPTIONS, *args, **kwargs) -> None: ... | ||
|
||
class SOCKSHTTPSConnection(SOCKSConnection, HTTPSConnection): ... | ||
|
||
class SOCKSHTTPConnectionPool(HTTPConnectionPool): | ||
ConnectionCls: ClassVar[type[SOCKSConnection]] | ||
|
||
class SOCKSHTTPSConnectionPool(HTTPSConnectionPool): | ||
ConnectionCls: ClassVar[type[SOCKSHTTPSConnection]] | ||
|
||
class _ConnectionPoolClasses(TypedDict): | ||
http: type[SOCKSHTTPConnectionPool] | ||
https: type[SOCKSHTTPSConnectionPool] | ||
|
||
class SOCKSProxyManager(PoolManager): | ||
# has a class-level default, but is overridden on instances, so not a ClassVar | ||
pool_classes_by_scheme: _ConnectionPoolClasses | ||
proxy_url: str | ||
|
||
def __init__( | ||
self, | ||
proxy_url: str, | ||
username: str | None = ..., | ||
password: str | None = ..., | ||
num_pools: int = ..., | ||
headers: Mapping[str, str] | None = ..., | ||
**connection_pool_kw, | ||
) -> None: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from queue import Queue | ||
from typing import Any | ||
|
||
class LifoQueue(Queue[Any]): ... |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.