rocksock/http2: bump to latest
This commit is contained in:
11
http2.py
11
http2.py
@@ -75,7 +75,10 @@ def _is_textual_content_type(ct):
|
||||
return ct in TEXTUAL_CONTENT_TYPES_LIST
|
||||
|
||||
class RsHttp():
|
||||
def __init__(self, host, port=80, ssl=False, follow_redirects=False, auto_set_cookies=False, keep_alive=False, timeout=60, user_agent=None, proxies=None, max_tries=10, log_errors=True, **kwargs):
|
||||
def __init__(self, host, port=80, ssl=False, follow_redirects=False, \
|
||||
auto_set_cookies=False, keep_alive=False, timeout=60, \
|
||||
user_agent=None, proxies=None, max_tries=10, log_errors=True, \
|
||||
**kwargs):
|
||||
self.host = host
|
||||
self.port = port
|
||||
self.use_ssl = ssl
|
||||
@@ -89,8 +92,12 @@ class RsHttp():
|
||||
self.cookies = dict()
|
||||
self.max_tries = max_tries
|
||||
self.log_errors = log_errors
|
||||
self.last_rs_exception = None
|
||||
self.headers = []
|
||||
|
||||
def get_last_rocksock_exception(self):
|
||||
return self.last_rs_exception
|
||||
|
||||
def _err_log(self, s):
|
||||
if self.log_errors:
|
||||
sys.stderr.write(s + '\n')
|
||||
@@ -244,6 +251,7 @@ class RsHttp():
|
||||
self.conn.connect()
|
||||
return True
|
||||
except RocksockException as e:
|
||||
self.last_rs_exception = e
|
||||
if e.errortype == rocksock.RS_ET_GAI and e.error==-2:
|
||||
# -2: Name does not resolve
|
||||
self.conn.disconnect()
|
||||
@@ -279,6 +287,7 @@ class RsHttp():
|
||||
try:
|
||||
return func(*args)
|
||||
except RocksockException as e:
|
||||
self.last_rs_exception = e
|
||||
self.conn.disconnect()
|
||||
if not self.reconnect(): return failret
|
||||
except IOError:
|
||||
|
||||
Reference in New Issue
Block a user