Last active
August 29, 2015 14:12
-
-
Save GaretJax/9b0d6ce0ea61feb24449 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 logging, requests, pprint | |
# Setup logging | |
logging.basicConfig(level=logging.DEBUG) | |
base = 'https://<instance>.atlassian.net' | |
username = 'user' | |
password = '******' | |
session = requests.Session() | |
session.auth = (username, password) | |
# Get the server info | |
url = base + '/rest/api/2/serverInfo' | |
r = session.get(url) | |
pprint.pprint(r.json()) | |
# Get an issue | |
url = base + '/rest/api/2/issue/CUA-1' | |
r = session.get(url) | |
pprint.pprint(r.json()) |
This file contains hidden or 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 logging, requests, pprint | |
# Setup logging | |
logging.basicConfig(level=logging.DEBUG) | |
base = 'https://<instance>.atlassian.net' | |
username = 'user' | |
password = '******' | |
session = requests.Session() | |
session.auth = (username, password) | |
# Get the server info | |
url = base + '/rest/api/2/serverInfo' | |
r = session.get(url) | |
pprint.pprint(r.json()) | |
# Get an issue | |
url = base + '/rest/api/2/issue/CUA-1' | |
r = session.get(url) | |
pprint.pprint(r.json()) | |
# Logout | |
url = base + '/rest/auth/1/session' | |
r = session.delete(url, headers=headers) | |
pprint.pprint(r.status_code) |
This file contains hidden or 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 | |
import pprint | |
import logging | |
from requests.cookies import RequestsCookieJar | |
logging.basicConfig(level=logging.DEBUG) | |
class ObliviousCookieJar(RequestsCookieJar): | |
def set_cookie(self, *args, **kwargs): | |
"""Simply ignore any request to set a cookie.""" | |
pass | |
def copy(self): | |
"""Make sure to return an instance of the correct class on copying.""" | |
return ObliviousCookieJar() | |
base = 'https://<instance>.atlassian.net' | |
username = 'user' | |
password = '******' | |
session = requests.Session() | |
session.cookies = ObliviousCookieJar() | |
session.auth = (username, password) | |
# Get the server info | |
url = base + '/rest/api/2/serverInfo' | |
r = session.get(url) | |
pprint.pprint(r.json()) | |
# Get an issue | |
url = base + '/rest/api/2/issue/CUA-1' | |
r = session.get(url) | |
pprint.pprint(r.json()) |
This file contains hidden or 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 logging, requests, pprint | |
# Setup logging | |
logging.basicConfig(level=logging.DEBUG) | |
base = 'https://<instance>.atlassian.net' | |
username = 'user' | |
password = '******' | |
session = requests.Session() | |
session.auth = (username, password) | |
# Get the server info | |
url = base + '/rest/api/2/serverInfo' | |
r = session.get(url) | |
pprint.pprint(r.json()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment