Skip to content

Commit

Permalink
support socks proxy protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanprjcts committed Apr 12, 2018
1 parent 708b0dd commit 06452fe
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions docs/about/release-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ To upgrade Sdklib to the latest version, use pip:
Sdklib 1.10.x series
===================

Sdklib 1.10.3
-------------

- New experimental feature: support socks proxy protocol.

Sdklib 1.10.2
-------------

Expand Down
3 changes: 2 additions & 1 deletion requirements/requirements-optionals.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
behave
lxml==3.6.0
lxml==3.6.0
PySocks
2 changes: 1 addition & 1 deletion sdklib/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
release = '1.10.2'
release = '1.10.3'
8 changes: 7 additions & 1 deletion sdklib/http/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,13 @@ def default_headers(self):

@staticmethod
def get_pool_manager(proxy=None):
if proxy is not None:
if proxy is not None and proxy.startswith("socks"):
from urllib3.contrib.socks import SOCKSProxyManager
pm = SOCKSProxyManager(
proxy,
num_pools=10,
)
elif proxy is not None:
pm = urllib3.ProxyManager(
proxy,
num_pools=10,
Expand Down

0 comments on commit 06452fe

Please sign in to comment.