def make_request(url, json_data=None, method="post", headers=None):
if (headers is None):
headers = {
"Content-Type": "application/json",
"Accept": "application/json"
}
try:
func = getattr(requests, method)
if (json_data):
response = func(url, json=json_data, headers=headers)
else:
response = func(url, headers=headers)
if (response.content):
return json.loads(response.content)
except Exception as e:
app.ext_logger.exception(e)
return None
评论列表
文章目录