def get_url(url):
'''request url'''
headers = {'Content-type': 'application/json'}
auth = (controller['any_user'], controller['any_pass'])
logging.info(url)
try:
response = requests.get(url, headers=headers, auth=auth, verify=False)
logging.info("Url GET Status: %s" % response.status_code)
if response.status_code in [200]:
return True, response.json()
else:
return False, str(response.text)
except requests.exceptions.ConnectionError, e:
logging.error('Connection Error: %s' % e.message)
return False, str(e.message)
评论列表
文章目录