mirror of
https://github.com/shmilylty/OneForAll.git
synced 2026-08-26 04:47:48 +08:00
添加delete方法
This commit is contained in:
+27
-1
@@ -128,7 +128,7 @@ class Module(object):
|
|||||||
Custom post request
|
Custom post request
|
||||||
|
|
||||||
:param str url: request url
|
:param str url: request url
|
||||||
:param dict data: request parameters
|
:param dict data: request data
|
||||||
:param bool check: check response
|
:param bool check: check response
|
||||||
:param kwargs: other params
|
:param kwargs: other params
|
||||||
:return: requests's response object
|
:return: requests's response object
|
||||||
@@ -151,6 +151,32 @@ class Module(object):
|
|||||||
return resp
|
return resp
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def delete(self, url, check=True, **kwargs):
|
||||||
|
"""
|
||||||
|
Custom delete request
|
||||||
|
|
||||||
|
:param str url: request url
|
||||||
|
:param bool check: check response
|
||||||
|
:param kwargs: other params
|
||||||
|
:return: requests's response object
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
resp = requests.delete(url,
|
||||||
|
cookies=self.cookie,
|
||||||
|
headers=self.header,
|
||||||
|
proxies=self.proxy,
|
||||||
|
timeout=self.timeout,
|
||||||
|
verify=self.verify,
|
||||||
|
**kwargs)
|
||||||
|
except Exception as e:
|
||||||
|
logger.log('ERROR', e.args)
|
||||||
|
return None
|
||||||
|
if not check:
|
||||||
|
return resp
|
||||||
|
if utils.check_response('DELETE', resp):
|
||||||
|
return resp
|
||||||
|
return None
|
||||||
|
|
||||||
def get_header(self):
|
def get_header(self):
|
||||||
"""
|
"""
|
||||||
Get request header
|
Get request header
|
||||||
|
|||||||
Reference in New Issue
Block a user