Skip to content

Commit

Permalink
Merge pull request #71 from mleinart/socksipy_compatibility/setdefaul…
Browse files Browse the repository at this point in the history
…tproxy

Make SocksiPy legacy functions kwarg-compatible
  • Loading branch information
Anorov authored Mar 23, 2017
2 parents 485c4fe + 682ac28 commit 68c0b6e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions socks.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ def set_default_proxy(proxy_type=None, addr=None, port=None, rdns=True, username
username.encode() if username else None,
password.encode() if password else None)

setdefaultproxy = set_default_proxy
def setdefaultproxy(*args, **kwargs):
if 'proxytype' in kwargs:
kwargs['proxy_type'] = kwargs.pop('proxytype')
return set_default_proxy(*args, **kwargs)

def get_default_proxy():
"""
Expand Down Expand Up @@ -344,7 +347,10 @@ def set_proxy(self, proxy_type=None, addr=None, port=None, rdns=True, username=N
username.encode() if username else None,
password.encode() if password else None)

setproxy = set_proxy
def setproxy(self, *args, **kwargs):
if 'proxytype' in kwargs:
kwargs['proxy_type'] = kwargs.pop('proxytype')
return self.set_proxy(*args, **kwargs)

def bind(self, *pos, **kw):
"""
Expand Down

0 comments on commit 68c0b6e

Please sign in to comment.