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