Search code examples
pythonjirabasic-authenticationpython-jira

python JIRA connection with proxy


I'm trying to connect via python-jira using a proxy:

server = {"server": "https://ip:port/jira",
          'proxies': {"http": "http://ip:port", "https": "http://ip:port"},
          'verify': False,
          'stream': True}

cls.jira_object = JIRA(options=server,
                       basic_auth=(user, password),
                       validate=True)

Traceback error:

tests\jira_test\ticket_test.py:52: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
build\bdist.win-amd64\egg\jira\client.py:217: in __init__
    ???
build\bdist.win-amd64\egg\jira\client.py:1841: in session
    ???
build\bdist.win-amd64\egg\jira\utils.py:78: in json_loads
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

r = None, verb = '???', kwargs = {}, request = None, headers = None

>   ???
E   JIRAError: JiraError HTTP None

Any idea how to allow jira-python to connect with proxy?


Solution

  • You can provide the proxy to the constructor of JIRA:

    cls.jira_object = JIRA(options=server,
                           basic_auth=(user, password),
                           validate=True,
                           proxies={"http": "http://ip:port", "https": "http://ip:port"})
    

    Remember to remove the "proxies" from your options dict

    More info about the constructor: https://github.com/pycontribs/jira/blob/develop/jira/client.py