Viewing File: /opt/alt/python38/lib/python3.8/site-packages/__pycache__/sockshandler.cpython-38.pyc
U
"@Wa @ s& d Z ddlZzddlZddlZW n, ek
rL ddlmZ ddlmZ Y nX ddl Z dd Z
G dd dejZG dd dej
ZG d d
d
ejejZedkr"ddlZzeejd ZW n eefk
r d
ZY nX eee jdeZeded eded dS )z
SocksiPy + urllib2 handler
version: 0.3
author: e<e@tr0ll.in>
This module provides a Handler which you can use with urllib2 to allow it to tunnel your connection through a socks.sockssocket socket, with out monkey patching the original socket...
Nc C s | }|| |S N)copyupdate)abd r /sockshandler.py
merge_dict s
r
c @ s e Zd ZdddZdd ZdS )SocksiPyConnectionNTc O s* ||||||f| _ tjj| f|| d S r ) proxyargshttplibHTTPConnection__init__ selfZ proxytypeZ proxyaddrZ proxyportZrdnsZusernameZpasswordargskwargsr r r r s zSocksiPyConnection.__init__c C sP t | _| jj| j t| jttfkr8| j | j | j
| j| jf d S r )
socks
socksocketsocksetproxyr typetimeoutintfloat
settimeoutconnecthostportr r r r r s
zSocksiPyConnection.connect)NTNN__name__
__module____qualname__r r r r r r r s
r c @ s e Zd ZdddZdd ZdS )SocksiPyConnectionSNTc O s* ||||||f| _ tjj| f|| d S r )r r
HTTPSConnectionr r r r r r ' s zSocksiPyConnectionS.__init__c C s\ t }|j| j t| jttfkr2|| j | | j
| jf t
|| j| j| _d S r )r r r r r r r r r r r r sslZwrap_socketZkey_fileZ cert_filer )r r r r r r + s zSocksiPyConnectionS.connect)NTNNr! r r r r r% &