Created
August 30, 2012 20:41
-
-
Save schadr/3540382 to your computer and use it in GitHub Desktop.
Shows how to requests the content for a URI from a Jazz server, including authentication with the server, using the request lib for python
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
import requests | |
user= 'your jazz username' | |
pw = 'your jazz password' | |
host = 'https://jazzhost:port/something'#/ROOTSERVICES | |
resource_uri = 'https://jazzhost:port/some_uri.json' | |
r = requests.get(host + '/authenticate/identidty', headers={'Accept':'application/xml'}, allow_redirects=True, verify=False) | |
r = requests.post(host + '/j_security_check', allow_redirects=True, verify=False, data={'j_username':user,'j_password':pw}, cookies=r.cookies) | |
r = requests.get( resource_uri, allow_redirects=True, verify=False, cookies=r.cookies) | |
r.json# contains the json response as dictionary of lists/diciotnaries |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment