# __author__ = 'bdm4' [oauth example code came from this author] # prototyping script for LibAnswers/LibWizard POST/API program import requests, json token_url = "https://uis.libanswers.com/api/1.1/oauth/token" test_api_url = "https://uis.libanswers.com/api/1.1/ticket/create" client_id = client_secret = data = {'grant_type': 'client_credentials'} access_token_response = requests.post(token_url, data=data, verify=True, allow_redirects=False, auth=(client_id, client_secret)) tokens = json.loads(access_token_response.text) api_call_headers = {'Authorization': 'Bearer ' + tokens['access_token']} post_data = {'quid':'5231', 'pquestion': 'test_pquestion', 'pdetails':'test_pdetails', 'pname':'test_pname', 'pemail':'test_pemail', 'ip':'test_ip'} api_call_response = requests.post(test_api_url, headers=api_call_headers, verify=True, data=post_data) print(api_call_response.text)