小编Nea*_*din的帖子

使用jira-python进行基本身份验证

我是新来的Python,新来的JIRA-Python库,以及新的网络编程,但我确实有相当多的与应用和集成编程和数据库查询的经验(尽管它已经有一段时间).

使用Python 2.7并请求1.0.3

我正在尝试使用这个库 - http://jira-python.readthedocs.org/en/latest/来使用Python查询Jira 5.1.我使用未经身份验证的查询成功连接,但我必须更改一行client.py,更改

我变了

self._session = requests.session(verify=verify, hooks={'args': self._add_content_type}) 
Run Code Online (Sandbox Code Playgroud)

self._session = requests.session() 
Run Code Online (Sandbox Code Playgroud)

我不知道我在做什么,但在更改之前我收到了一个错误,在更改之后我得到了一个成功的项目名称列表返回.

然后我尝试了基本身份验证,以便我可以利用我的Jira权限并进行报告.最初也失败了.我做了同样的改变

def _create_http_basic_session
Run Code Online (Sandbox Code Playgroud)

client.py,但现在我只是得到另一个错误.所以问题没有解决.现在我得到一个不同的错误:

HTTP Status 415 - Unsupported Media Type
type Status report
message Unsupported Media Type

description The server refused this request because the request entity is in
a format not` `supported by the requested resource for the requested method 
(Unsupported Media Type).
Run Code Online (Sandbox Code Playgroud)

.于是我决定做一个超级简单的测试只使用请求模块,我相信这是正在使用JIRA的Python模块,并且该代码似乎在登录我我得到了良好的反响:

import requests

r = requests.get(the_url, auth=(my username , password))
print r.text …
Run Code Online (Sandbox Code Playgroud)

python jira

4
推荐指数
2
解决办法
2万
查看次数

标签 统计

jira ×1

python ×1