Skip to content

Commit 7b8f81b

Browse files
authored
Merge pull request #50 from skelsec/master
Adding Windows compatibility
2 parents de2632b + 597c2b2 commit 7b8f81b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

socks.py

+12
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,21 @@
5959
from errno import EOPNOTSUPP, EINVAL, EAGAIN
6060
from io import BytesIO
6161
from os import SEEK_CUR
62+
import os
6263
from collections import Callable
6364
from base64 import b64encode
6465

66+
67+
if os.name == 'nt':
68+
try:
69+
import win_inet_pton
70+
import socket
71+
except ImportError:
72+
raise ImportError('To run PySocks under windows you need to install win_inet_pton')
73+
else:
74+
import socket
75+
76+
6577
PROXY_TYPE_SOCKS4 = SOCKS4 = 1
6678
PROXY_TYPE_SOCKS5 = SOCKS5 = 2
6779
PROXY_TYPE_HTTP = HTTP = 3

0 commit comments

Comments
 (0)