@@ -94,16 +94,34 @@ def curl_perform(self, crl):
9494
9595 def curl_setup (self , proxy = None , timeout = 0 ):
9696 """
97- set curl options
97+ Set curl options
98+ - http://pycurl.io/docs/latest/
99+ - https://curl.haxx.se/libcurl/c/curl_easy_setopt.html
100+
101+ Proxy options (str or dict):
102+ proxy = 'https://example.com:80' # pycurl.PROXY
103+ proxy = {
104+ 'PROXY': <str> host, # pycurl.PROXY
105+ 'PORT': <int> port, # pycurl.PROXYPORT
106+ 'USERPWD': <str> user:pwd, # pycurl.PROXYUSERPWD
107+ }
98108 """
99109
100110 crl = pycurl .Curl ()
101111 crl .setopt (pycurl .USERAGENT , user_agent ())
102112 crl .setopt (pycurl .FOLLOWLOCATION , True )
103113 crl .setopt (pycurl .CAINFO , certifi .where ())
104114
105- if proxy :
115+ if isinstance ( proxy , str ) :
106116 crl .setopt (pycurl .PROXY , proxy )
117+ if isinstance (proxy , dict ):
118+ if proxy .get ('PROXY' ):
119+ crl .setopt (pycurl .PROXY , proxy ['PROXY' ])
120+ if proxy .get ('PORT' ):
121+ crl .setopt (pycurl .PROXYPORT , proxy ['PORT' ])
122+ if proxy .get ('USERPWD' ):
123+ crl .setopt (pycurl .PROXYUSERPWD , proxy ['USERPWD' ])
124+
107125 if timeout : # 0 = wait forever
108126 crl .setopt (pycurl .CONNECTTIMEOUT , timeout )
109127 crl .setopt (pycurl .TIMEOUT , timeout )
0 commit comments