Created
September 21, 2012 06:58
-
-
Save ranman/3760095 to your computer and use it in GitHub Desktop.
xgen jira wrapper
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 | |
import json | |
from jira.client import JIRA | |
from jira.client import raise_on_error | |
# This class is neccesary because of broken jira-python scripts from Atlassian | |
class XgenJIRA(JIRA): | |
def __init__(self, *args, **kwargs): | |
super(XgenJIRA, self).__init__(*args, **kwargs) | |
def _create_http_basic_session(self, username, password): | |
url = self._options['server'] + '/rest/auth/1/session' | |
payload = { | |
'username': username, | |
'password': password | |
} | |
verify = self._options['server'].startswith('https') | |
self._session = requests.session(verify=verify, | |
hooks={'args': self._add_content_type}) | |
r = self._session.post(url, | |
data=json.dumps(payload), | |
auth=(username, password)) | |
raise_on_error(r) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment