This commit is contained in:
yumoqing 2020-06-05 09:54:55 +08:00
parent a10afe270f
commit e702b93762
2 changed files with 7 additions and 3 deletions

View File

@ -39,9 +39,12 @@ class DictObject:
def __setitem__(self,name,value):
self.kwargs[name] = value
def __delattr__(self,name):
def __delitem__(self,name):
self.kwargs.pop(name)
def get(self,name,dv=None):
return self.kwargs.get(name,dv)
def copy(self):
return self.kwargs.copy()

View File

@ -20,9 +20,10 @@ class HTTPError(Exception):
hostsessions = {}
class HttpClient:
class Http_Client:
def __init__(self):
self.s = requests.Session()
self.s.verify = False
def url2domain(self,url):
parts = url.split('/')[:3]
@ -64,7 +65,7 @@ class HttpClient:
print('Error', url, method,
params, resp.status_code,
type(resp.status_code))
raise HTTPError(resp.status_code)
raise HTTPError(resp.status_code,url)
return resp
def webcall(self,url,method="GET",