def _req(self, method, frag, data=None):
resp = requests.request(method, self.url + frag,
data=json.dumps(data, default=_json_serial),
verify=self.verify,
auth=self.credentials,
headers={'Content-Type': 'application/json'})
# try to extract reason from response when request returns error
if 400 <= resp.status_code < 600:
try:
resp.reason = json.loads(resp.text)['Message'];
except:
pass;
resp.raise_for_status()
return resp
评论列表
文章目录