Skip to content

Commit d2aea5a

Browse files
authored
Merge pull request #107 from hugovk/update-versions
Update supported Python versions
2 parents 2c3ec57 + d2c40b8 commit d2aea5a

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ I no longer have the time to actively work on this project. I will gladly accept
1515
Features
1616
========
1717

18-
* SOCKS proxy client for Python 2.6 - 3.x
18+
* SOCKS proxy client for Python 2.7 and 3.4+
1919
* TCP and UDP both supported
2020
* HTTP proxy client included but not supported or recommended (you should use urllib2's or requests' own HTTP proxy interface)
2121
* urllib2 handler included. `pip install` / `setup.py install` will automatically install the `sockshandler` module.

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@
2121
keywords = ["socks", "proxy"],
2222
py_modules=["socks", "sockshandler"],
2323
install_requires=requirements,
24+
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
2425
classifiers=(
25-
'Programming Language :: Python :: 2.6',
26+
'Programming Language :: Python :: 2',
2627
'Programming Language :: Python :: 2.7',
2728
'Programming Language :: Python :: 3',
29+
'Programming Language :: Python :: 3.4',
30+
'Programming Language :: Python :: 3.5',
31+
'Programming Language :: Python :: 3.6',
2832
)
2933
)

socks.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def __init__(self, msg, socket_err=None):
117117
self.socket_err = socket_err
118118

119119
if socket_err:
120-
self.msg += ": {0}".format(socket_err)
120+
self.msg += ": {}".format(socket_err)
121121

122122
def __str__(self):
123123
return self.msg
@@ -586,7 +586,7 @@ def _SOCKS5_request(self, conn, cmd, dst):
586586
if status != 0x00:
587587
# Connection failed: server returned an error
588588
error = SOCKS5_ERRORS.get(status, "Unknown error")
589-
raise SOCKS5Error("{0:#04x}: {1}".format(status, error))
589+
raise SOCKS5Error("{:#04x}: {}".format(status, error))
590590

591591
# Get the bound address/port
592592
bnd = self._read_SOCKS5_address(reader)
@@ -704,7 +704,7 @@ def _negotiate_SOCKS4(self, dest_addr, dest_port):
704704
if status != 0x5A:
705705
# Connection failed: server returned an error
706706
error = SOCKS4_ERRORS.get(status, "Unknown error")
707-
raise SOCKS4Error("{0:#04x}: {1}".format(status, error))
707+
raise SOCKS4Error("{:#04x}: {}".format(status, error))
708708

709709
# Get the bound address/port
710710
self.proxy_sockname = (socket.inet_ntoa(resp[4:]),
@@ -764,7 +764,7 @@ def _negotiate_HTTP(self, dest_addr, dest_port):
764764
"HTTP proxy server did not return a valid HTTP status")
765765

766766
if status_code != 200:
767-
error = "{0}: {1}".format(status_code, status_msg)
767+
error = "{}: {}".format(status_code, status_msg)
768768
if status_code in (400, 403, 405):
769769
# It's likely that the HTTP proxy server does not support the
770770
# CONNECT tunneling method
@@ -847,10 +847,10 @@ def connect(self, dest_pair, catch_errors=None):
847847
self.close()
848848
if not catch_errors:
849849
proxy_addr, proxy_port = proxy_addr
850-
proxy_server = "{0}:{1}".format(proxy_addr, proxy_port)
850+
proxy_server = "{}:{}".format(proxy_addr, proxy_port)
851851
printable_type = PRINTABLE_PROXY_TYPES[proxy_type]
852852

853-
msg = "Error connecting to {0} proxy {1}".format(printable_type,
853+
msg = "Error connecting to {} proxy {}".format(printable_type,
854854
proxy_server)
855855
log.debug("%s due to: %s", msg, error)
856856
raise ProxyConnectionError(msg, error)

0 commit comments

Comments
 (0)