Skip to content

Instantly share code, notes, and snippets.

@ranman
Created September 21, 2012 06:58
Show Gist options
  • Save ranman/3760095 to your computer and use it in GitHub Desktop.
Save ranman/3760095 to your computer and use it in GitHub Desktop.
xgen jira wrapper
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