Python urllib.request.type() Examples
The following are 6
code examples of urllib.request.type().
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.request
, or try the search function
.
Example #1
Source File: cookiejar.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def return_ok_secure(self, cookie, request): if cookie.secure and request.type != "https": _debug(" secure cookie with non-secure request") return False return True
Example #2
Source File: cookiejar.py From Imogen with MIT License | 5 votes |
def return_ok_secure(self, cookie, request): if cookie.secure and request.type != "https": _debug(" secure cookie with non-secure request") return False return True
Example #3
Source File: worker.py From brozzler with Apache License 2.0 | 5 votes |
def _warcprox_write_record( self, warcprox_address, url, warc_type, content_type, payload, extra_headers=None): headers = {"Content-Type":content_type,"WARC-Type":warc_type,"Host":"N/A"} if extra_headers: headers.update(extra_headers) request = urllib.request.Request(url, method="WARCPROX_WRITE_RECORD", headers=headers, data=payload) # XXX setting request.type="http" is a hack to stop urllib from trying # to tunnel if url is https request.type = "http" request.set_proxy(warcprox_address, "http") try: with urllib.request.urlopen(request, timeout=600) as response: if response.getcode() != 204: self.logger.warning( 'got "%s %s" response on warcprox ' 'WARCPROX_WRITE_RECORD request (expected 204)', response.getcode(), response.reason) return request, response except urllib.error.HTTPError as e: self.logger.warning( 'got "%s %s" response on warcprox ' 'WARCPROX_WRITE_RECORD request (expected 204)', e.getcode(), e.info()) return request, None except urllib.error.URLError as e: raise brozzler.ProxyError( 'proxy error on WARCPROX_WRITE_RECORD %s' % url) from e except ConnectionError as e: raise brozzler.ProxyError( 'proxy error on WARCPROX_WRITE_RECORD %s' % url) from e
Example #4
Source File: cookiejar.py From ironpython3 with Apache License 2.0 | 5 votes |
def return_ok_secure(self, cookie, request): if cookie.secure and request.type != "https": _debug(" secure cookie with non-secure request") return False return True
Example #5
Source File: cookiejar.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def return_ok_secure(self, cookie, request): if cookie.secure and request.type != "https": _debug(" secure cookie with non-secure request") return False return True
Example #6
Source File: cookiejar.py From android_universal with MIT License | 5 votes |
def return_ok_secure(self, cookie, request): if cookie.secure and request.type != "https": _debug(" secure cookie with non-secure request") return False return True