Python httplib.ResponseNotReady() Examples
The following are 29
code examples of httplib.ResponseNotReady().
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
httplib
, or try the search function
.
Example #1
Source File: __init__.py From luci-py with Apache License 2.0 | 5 votes |
def HTTPResponse__getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise httplib.ResponseNotReady() return self.msg.items()
Example #2
Source File: __init__.py From Sepia with GNU General Public License v2.0 | 5 votes |
def HTTPResponse__getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise httplib.ResponseNotReady() return self.msg.items()
Example #3
Source File: __init__.py From data with GNU General Public License v3.0 | 5 votes |
def HTTPResponse__getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise httplib.ResponseNotReady() return self.msg.items()
Example #4
Source File: __init__.py From data with GNU General Public License v3.0 | 5 votes |
def HTTPResponse__getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise httplib.ResponseNotReady() return self.msg.items()
Example #5
Source File: __init__.py From data with GNU General Public License v3.0 | 5 votes |
def HTTPResponse__getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise httplib.ResponseNotReady() return self.msg.items()
Example #6
Source File: __init__.py From data with GNU General Public License v3.0 | 5 votes |
def HTTPResponse__getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise httplib.ResponseNotReady() return self.msg.items()
Example #7
Source File: __init__.py From data with GNU General Public License v3.0 | 5 votes |
def HTTPResponse__getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise httplib.ResponseNotReady() return self.msg.items()
Example #8
Source File: source.py From conary with Apache License 2.0 | 5 votes |
def extractMSIInfo(self, path, wbs): import robj self.fileType = 'msi' self.path = path # This is here for backwards compatibility. if not wbs.startswith('http'): wbs = 'http://%s/api' % wbs api = robj.connect(wbs) api.msis.append(dict( path=os.path.split(path)[1], size=os.stat(path).st_size, )) self.resource = api.msis[-1] # put the actual file contents self.resource.path = open(path) self.resource.refresh() self.productName = self.resource.name.encode('utf-8') name = self.productName.split() if len(name) > 1 and '.' in name[-1]: name = '-'.join(name[:-1]) else: name = '-'.join(name) self.name = name self.version = self.resource.version.encode('utf-8') self.platform = self.resource.platform.encode('utf-8') self.productCode = self.resource.productCode.encode('utf-8') self.upgradeCode = self.resource.upgradeCode.encode('utf-8') self.components = [ (x.uuid.encode('utf-8'), x.path.encode('utf-8')) for x in self.resource.components ] # clean up try: self.resource.delete() except httplib.ResponseNotReady: pass
Example #9
Source File: __init__.py From SA-ctf_scoreboard with Creative Commons Zero v1.0 Universal | 5 votes |
def HTTPResponse__getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise httplib.ResponseNotReady() return self.msg.items()
Example #10
Source File: keepalive.py From POC-EXP with GNU General Public License v3.0 | 5 votes |
def do_open(self, http_class, req): h = None host = req.get_host() if not host: raise urllib2.URLError('no host given') try: need_new_connection = 1 key = self._get_connection_key(host) h = self._connections.get(key) if not h is None: try: self._start_connection(h, req) except: r = None else: try: r = h.getresponse() except httplib.ResponseNotReady, e: r = None except httplib.BadStatusLine, e: r = None if r is None or r.version == 9: # httplib falls back to assuming HTTP 0.9 if it gets a # bad header back. This is most likely to happen if # the socket has been closed by the server since we # last used the connection. if DEBUG: print "failed to re-use connection to %s" % host h.close() else: if DEBUG: print "re-using connection to %s" % host need_new_connection = 0
Example #11
Source File: __init__.py From twitter-for-bigquery with Apache License 2.0 | 5 votes |
def HTTPResponse__getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise httplib.ResponseNotReady() return self.msg.items()
Example #12
Source File: __init__.py From luci-py with Apache License 2.0 | 5 votes |
def HTTPResponse__getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise httplib.ResponseNotReady() return self.msg.items()
Example #13
Source File: __init__.py From luci-py with Apache License 2.0 | 5 votes |
def HTTPResponse__getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise httplib.ResponseNotReady() return self.msg.items()
Example #14
Source File: __init__.py From luci-py with Apache License 2.0 | 5 votes |
def HTTPResponse__getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise httplib.ResponseNotReady() return self.msg.items()
Example #15
Source File: __init__.py From misp42splunk with GNU Lesser General Public License v3.0 | 5 votes |
def HTTPResponse__getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise httplib.ResponseNotReady() return self.msg.items()
Example #16
Source File: __init__.py From alfred-gmail with MIT License | 5 votes |
def HTTPResponse__getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise httplib.ResponseNotReady() return self.msg.items()
Example #17
Source File: __init__.py From googleapps-message-recall with Apache License 2.0 | 5 votes |
def HTTPResponse__getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise httplib.ResponseNotReady() return self.msg.items()
Example #18
Source File: keepalive.py From NoobSec-Toolkit with GNU General Public License v2.0 | 5 votes |
def do_open(self, http_class, req): h = None host = req.get_host() if not host: raise urllib2.URLError('no host given') try: need_new_connection = 1 key = self._get_connection_key(host) h = self._connections.get(key) if not h is None: try: self._start_connection(h, req) except: r = None else: try: r = h.getresponse() except httplib.ResponseNotReady, e: r = None except httplib.BadStatusLine, e: r = None if r is None or r.version == 9: # httplib falls back to assuming HTTP 0.9 if it gets a # bad header back. This is most likely to happen if # the socket has been closed by the server since we # last used the connection. if DEBUG: print "failed to re-use connection to %s" % host h.close() else: if DEBUG: print "re-using connection to %s" % host need_new_connection = 0
Example #19
Source File: keepalive.py From NoobSec-Toolkit with GNU General Public License v2.0 | 5 votes |
def do_open(self, http_class, req): h = None host = req.get_host() if not host: raise urllib2.URLError('no host given') try: need_new_connection = 1 key = self._get_connection_key(host) h = self._connections.get(key) if not h is None: try: self._start_connection(h, req) except: r = None else: try: r = h.getresponse() except httplib.ResponseNotReady, e: r = None except httplib.BadStatusLine, e: r = None if r is None or r.version == 9: # httplib falls back to assuming HTTP 0.9 if it gets a # bad header back. This is most likely to happen if # the socket has been closed by the server since we # last used the connection. if DEBUG: print "failed to re-use connection to %s" % host h.close() else: if DEBUG: print "re-using connection to %s" % host need_new_connection = 0
Example #20
Source File: keepalive.py From NoobSec-Toolkit with GNU General Public License v2.0 | 5 votes |
def do_open(self, http_class, req): h = None host = req.get_host() if not host: raise urllib2.URLError('no host given') try: need_new_connection = 1 key = self._get_connection_key(host) h = self._connections.get(key) if not h is None: try: self._start_connection(h, req) except: r = None else: try: r = h.getresponse() except httplib.ResponseNotReady, e: r = None except httplib.BadStatusLine, e: r = None if r is None or r.version == 9: # httplib falls back to assuming HTTP 0.9 if it gets a # bad header back. This is most likely to happen if # the socket has been closed by the server since we # last used the connection. if DEBUG: print "failed to re-use connection to %s" % host h.close() else: if DEBUG: print "re-using connection to %s" % host need_new_connection = 0
Example #21
Source File: keepalive.py From NoobSec-Toolkit with GNU General Public License v2.0 | 5 votes |
def do_open(self, http_class, req): h = None host = req.get_host() if not host: raise urllib2.URLError('no host given') try: need_new_connection = 1 key = self._get_connection_key(host) h = self._connections.get(key) if not h is None: try: self._start_connection(h, req) except: r = None else: try: r = h.getresponse() except httplib.ResponseNotReady, e: r = None except httplib.BadStatusLine, e: r = None if r is None or r.version == 9: # httplib falls back to assuming HTTP 0.9 if it gets a # bad header back. This is most likely to happen if # the socket has been closed by the server since we # last used the connection. if DEBUG: print "failed to re-use connection to %s" % host h.close() else: if DEBUG: print "re-using connection to %s" % host need_new_connection = 0
Example #22
Source File: __init__.py From aqua-monitor with GNU Lesser General Public License v3.0 | 5 votes |
def HTTPResponse__getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise httplib.ResponseNotReady() return self.msg.items()
Example #23
Source File: __init__.py From billing-export-python with Apache License 2.0 | 5 votes |
def HTTPResponse__getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise httplib.ResponseNotReady() return self.msg.items()
Example #24
Source File: __init__.py From sndlatr with Apache License 2.0 | 5 votes |
def HTTPResponse__getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise httplib.ResponseNotReady() return self.msg.items()
Example #25
Source File: __init__.py From faces with GNU General Public License v2.0 | 5 votes |
def HTTPResponse__getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise httplib.ResponseNotReady() return self.msg.items()
Example #26
Source File: __init__.py From faces with GNU General Public License v2.0 | 5 votes |
def HTTPResponse__getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise httplib.ResponseNotReady() return self.msg.items()
Example #27
Source File: __init__.py From earthengine with MIT License | 5 votes |
def HTTPResponse__getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise httplib.ResponseNotReady() return self.msg.items()
Example #28
Source File: __init__.py From magnitude with MIT License | 4 votes |
def _prefetch_in_background(self, n, amount, offset): headers = { 'Range': "bytes=" + str(max(offset, 0)) + "-" + str( min((offset + amount) - 1, self.length) # noqa ), } self._wait_on_prefetch_connection(n) while not self.pconn_terminated[n]: try: self.pconn[n].request( "GET", self.parsed_url.path, headers=headers) break except CannotSendRequest: sleep(1) while not self.pconn_terminated[n]: try: res = self.pconn[n].getresponse() break except ResponseNotReady: # Since we are sharing the connection wait for this to be # ready sleep(1) if self.pconn_terminated[n]: self._unwait_on_prefetch_connection(n) return else: self._unwait_on_prefetch_connection(n) if not(res.status >= 200 and res.status <= 299): # Check for a valid status from the server return data = bytearray(res.length) i = 0 for piece in iter(lambda: res.read(1024), bytes('')): if not getattr(threading.currentThread(), "do_run", True): break data[i:i + len(piece)] = piece i = i + len(piece) else: return bytes(data) # Leaving the thread early, without # reading all of the data this will # make the connection unusable, refresh it self._prepare_prefetch_connection(n)
Example #29
Source File: __init__.py From supersqlite with MIT License | 4 votes |
def _prefetch_in_background(self, n, amount, offset): headers = { 'Range': "bytes=" + str(max(offset, 0)) + "-" + str( min((offset + amount) - 1, self.length) # noqa ), } self._wait_on_prefetch_connection(n) while not self.pconn_terminated[n]: try: self.pconn[n].request( "GET", self.parsed_url.path, headers=headers) break except CannotSendRequest: sleep(1) while not self.pconn_terminated[n]: try: res = self.pconn[n].getresponse() break except ResponseNotReady: # Since we are sharing the connection wait for this to be # ready sleep(1) if self.pconn_terminated[n]: self._unwait_on_prefetch_connection(n) return else: self._unwait_on_prefetch_connection(n) if not(res.status >= 200 and res.status <= 299): # Check for a valid status from the server return data = bytearray(res.length) i = 0 for piece in iter(lambda: res.read(1024), bytes('')): if not getattr(threading.currentThread(), "do_run", True): break data[i:i + len(piece)] = piece i = i + len(piece) else: return bytes(data) # Leaving the thread early, without # reading all of the data this will # make the connection unusable, refresh it self._prepare_prefetch_connection(n)