Last active
January 1, 2016 11:39
-
-
Save bryanbarnard/8139495 to your computer and use it in GitHub Desktop.
Sample Requests Python ServiceNow JSONv2 - GetIncident
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##Sample HTTP Request to ServiceNow Demo Instance Using JSONv2 Web Service | |
import requests | |
from requests.auth import HTTPBasicAuth | |
#using local http proxy to log requests and responses | |
proxies = { | |
"http": "http://127.0.0.1:8888", | |
"https": "https://127.0.0.1:8888", | |
} | |
auth = HTTPBasicAuth("admin", "admin") | |
uri = "https://demo006.service-now.com/incident.do?JSONv2&sysparm_sys_id=d71f7935c0a8016700802b64c67c11c6" | |
headers = { | |
"accept": "application/json;charset=utf-8", | |
"Content-Type": "application/json", | |
} | |
r = requests.get(url=uri, auth=auth, proxies=proxies, verify=False, headers=headers) | |
content = r.json() | |
print "Response Status Code: " + str(r.status_code) | |
print "Response JSON Content: " + str(content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment