本文介绍了python JIRA与代理的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用代理通过python-jira连接:

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)

跟踪错误:

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

任何想法如何允许jira-python与代理连接?

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

推荐答案

您可以为JIRA的构造函数提供代理:

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

有关构造函数的更多信息: https://github.com/pycontribs/jira/blob/develop/jira/client.py

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

这篇关于python JIRA与代理的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 04:33