Python urllib.FancyURLopener() Examples
The following are 30
code examples of urllib.FancyURLopener().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
urllib
, or try the search function
.
Example #1
Source File: ProxyHarvest.py From darkc0de-old-stuff with GNU General Public License v3.0 | 6 votes |
def proxyvalidator(proxylist): finalcount = 0 for proxy in proxylist: proxy.replace('\n', '') try: proxies = {'http': "http://"+proxy[:-1]} opener = urllib.FancyURLopener(proxies) try: loopchk = opener.open("http://www.google.com").read() except: pass except(IOError,socket.timeout), detail: pass ipcheck(proxy) alivelist.append(proxy) finalcount += 1
Example #2
Source File: ProxyHarvest.py From d4rkc0de with GNU General Public License v2.0 | 6 votes |
def proxyvalidator(proxylist): finalcount = 0 for proxy in proxylist: proxy.replace('\n', '') try: proxies = {'http': "http://"+proxy[:-1]} opener = urllib.FancyURLopener(proxies) try: loopchk = opener.open("http://www.google.com").read() except: pass except(IOError,socket.timeout), detail: pass ipcheck(proxy) alivelist.append(proxy) finalcount += 1
Example #3
Source File: robotparser.py From RevitBatchProcessor with GNU General Public License v3.0 | 5 votes |
def http_error_default(self, url, fp, errcode, errmsg, headers): self.errcode = errcode return urllib.FancyURLopener.http_error_default(self, url, fp, errcode, errmsg, headers)
Example #4
Source File: robotparser.py From medicare-demo with Apache License 2.0 | 5 votes |
def __init__(self, *args): urllib.FancyURLopener.__init__(self, *args) self.errcode = 200
Example #5
Source File: robotparser.py From medicare-demo with Apache License 2.0 | 5 votes |
def http_error_default(self, url, fp, errcode, errmsg, headers): self.errcode = errcode return urllib.FancyURLopener.http_error_default(self, url, fp, errcode, errmsg, headers)
Example #6
Source File: proxy.py From checkproxy with Apache License 2.0 | 5 votes |
def get_html(url=''): if proxy_use==1: opener = urllib.FancyURLopener({'http': 'http://'+proxy_ip+':'+proxy_port+'/'}) else: opener = urllib.FancyURLopener({}) opener.addheaders = [('User-agent','Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.76 Safari/537.36')] try: f = opener.open(url) return f.read() except Exception,e: print e return ''
Example #7
Source File: robotparser.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args): urllib.FancyURLopener.__init__(self, *args) self.errcode = 200
Example #8
Source File: robotparser.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def http_error_default(self, url, fp, errcode, errmsg, headers): self.errcode = errcode return urllib.FancyURLopener.http_error_default(self, url, fp, errcode, errmsg, headers)
Example #9
Source File: robotparser.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args): urllib.FancyURLopener.__init__(self, *args) self.errcode = 200
Example #10
Source File: robotparser.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def http_error_default(self, url, fp, errcode, errmsg, headers): self.errcode = errcode return urllib.FancyURLopener.http_error_default(self, url, fp, errcode, errmsg, headers)
Example #11
Source File: test_urllibnet.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_getcode(self): # test getcode() with the fancy opener to get 404 error codes URL = "http://www.python.org/XXXinvalidXXX" open_url = urllib.FancyURLopener().open(URL) try: code = open_url.getcode() finally: open_url.close() self.assertEqual(code, 404)
Example #12
Source File: AuthorizeNet.py From termite-visualizations with BSD 3-Clause "New" or "Revised" License | 5 votes |
def process(self): encoded_args = urllib.urlencode(self.parameters) if self.testmode == True: url = 'https://test.authorize.net/gateway/transact.dll' else: url = 'https://secure.authorize.net/gateway/transact.dll' if self.proxy is None: self.results += str(urllib.urlopen( url, encoded_args).read()).split(self.delimiter) else: opener = urllib.FancyURLopener(self.proxy) opened = opener.open(url, encoded_args) try: self.results += str(opened.read()).split(self.delimiter) finally: opened.close() Results = namedtuple('Results', 'ResultResponse ResponseSubcode ResponseCode ResponseText AuthCode \ AVSResponse TransactionID InvoiceNumber Description Amount PaymentMethod \ TransactionType CustomerID CHFirstName CHLastName Company BillingAddress \ BillingCity BillingState BillingZip BillingCountry Phone Fax Email ShippingFirstName \ ShippingLastName ShippingCompany ShippingAddress ShippingCity ShippingState \ ShippingZip ShippingCountry TaxAmount DutyAmount FreightAmount TaxExemptFlag \ PONumber MD5Hash CVVResponse CAVVResponse') self.response = Results(*tuple(r for r in self.results)[0:40]) if self.getResultResponseFull() == 'Approved': self.error = False self.success = True self.declined = False elif self.getResultResponseFull() == 'Declined': self.error = False self.success = False self.declined = True else: raise AIM.AIMError(self.response.ResponseText)
Example #13
Source File: DowCommerce.py From termite-visualizations with BSD 3-Clause "New" or "Revised" License | 5 votes |
def process(self): encoded_args = urllib.urlencode(self.parameters) if self.proxy is None: results = str(urllib.urlopen( self.url, encoded_args).read()).split(self.delimiter) else: opener = urllib.FancyURLopener(self.proxy) opened = opener.open(self.url, encoded_args) try: results = str(opened.read()).split(self.delimiter) finally: opened.close() for result in results: (key, val) = result.split('=') self.results[key] = val if self.results['response'] == '1': self.error = False self.success = True self.declined = False elif self.results['response'] == '2': self.error = False self.success = False self.declined = True elif self.results['response'] == '3': self.error = True self.success = False self.declined = False else: self.error = True self.success = False self.declined = False raise DowCommerce.DowCommerceError(self.results)
Example #14
Source File: robotparser.py From RevitBatchProcessor with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args): urllib.FancyURLopener.__init__(self, *args) self.errcode = 200
Example #15
Source File: robotparser.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def http_error_default(self, url, fp, errcode, errmsg, headers): self.errcode = errcode return urllib.FancyURLopener.http_error_default(self, url, fp, errcode, errmsg, headers)
Example #16
Source File: service.py From service.subtitles.subdivx with GNU General Public License v2.0 | 5 votes |
def get_url(url): class MyOpener(FancyURLopener): # version = HTTP_USER_AGENT version = '' my_urlopener = MyOpener() log(u"Fetching %s" % url) try: response = my_urlopener.open(url) content = response.read() except Exception: log(u"Failed to fetch %s" % url, level=LOGWARNING) content = None return content
Example #17
Source File: robotparser.py From PokemonGo-DesktopMap with MIT License | 5 votes |
def __init__(self, *args): urllib.FancyURLopener.__init__(self, *args) self.errcode = 200
Example #18
Source File: robotparser.py From PokemonGo-DesktopMap with MIT License | 5 votes |
def http_error_default(self, url, fp, errcode, errmsg, headers): self.errcode = errcode return urllib.FancyURLopener.http_error_default(self, url, fp, errcode, errmsg, headers)
Example #19
Source File: robotparser.py From unity-python with MIT License | 5 votes |
def __init__(self, *args): urllib.FancyURLopener.__init__(self, *args) self.errcode = 200
Example #20
Source File: robotparser.py From unity-python with MIT License | 5 votes |
def http_error_default(self, url, fp, errcode, errmsg, headers): self.errcode = errcode return urllib.FancyURLopener.http_error_default(self, url, fp, errcode, errmsg, headers)
Example #21
Source File: robotparser.py From canape with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args): urllib.FancyURLopener.__init__(self, *args) self.errcode = 200
Example #22
Source File: robotparser.py From canape with GNU General Public License v3.0 | 5 votes |
def http_error_default(self, url, fp, errcode, errmsg, headers): self.errcode = errcode return urllib.FancyURLopener.http_error_default(self, url, fp, errcode, errmsg, headers)
Example #23
Source File: robotparser.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args): urllib.FancyURLopener.__init__(self, *args) self.errcode = 200
Example #24
Source File: robotparser.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def http_error_default(self, url, fp, errcode, errmsg, headers): self.errcode = errcode return urllib.FancyURLopener.http_error_default(self, url, fp, errcode, errmsg, headers)
Example #25
Source File: robotparser.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args): urllib.FancyURLopener.__init__(self, *args) self.errcode = 200
Example #26
Source File: robotparser.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def http_error_default(self, url, fp, errcode, errmsg, headers): self.errcode = errcode return urllib.FancyURLopener.http_error_default(self, url, fp, errcode, errmsg, headers)
Example #27
Source File: test_urllibnet.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_getcode(self): # test getcode() with the fancy opener to get 404 error codes URL = "http://www.python.org/XXXinvalidXXX" open_url = urllib.FancyURLopener().open(URL) try: code = open_url.getcode() finally: open_url.close() self.assertEqual(code, 404)
Example #28
Source File: robotparser.py From oss-ftp with MIT License | 5 votes |
def __init__(self, *args): urllib.FancyURLopener.__init__(self, *args) self.errcode = 200
Example #29
Source File: robotparser.py From meddle with MIT License | 5 votes |
def http_error_default(self, url, fp, errcode, errmsg, headers): self.errcode = errcode return urllib.FancyURLopener.http_error_default(self, url, fp, errcode, errmsg, headers)
Example #30
Source File: robotparser.py From ironpython2 with Apache License 2.0 | 5 votes |
def __init__(self, *args): urllib.FancyURLopener.__init__(self, *args) self.errcode = 200