我是 Python 新手,jira-python 库新手,网络编程新手,尽管我在应用程序和集成编程以及数据库查询方面确实有相当多的经验(尽管已经有一段时间了)。
使用Python 2.7和请求1.0.3
我正在尝试使用这个库 -http://jira-python.readthedocs.org/en/latest/ 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})
to
self._session = requests.session()
我不知道我到底在做什么,但在更改之前我收到了一个错误,而在更改之后我得到了返回的成功项目名称列表。
然后我尝试了基本身份验证,这样我就可以利用我的 Jira 权限并进行报告。最初也失败了。我做了同样的改变
def _create_http_basic_session
in 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).
因此,我决定仅使用 requests 模块进行一个超级简单的测试,我相信 jira-python 模块正在使用该模块,并且此代码似乎让我登录。我得到了很好的响应:
import requests
r = requests.get(the_url, auth=(my username , password))
print r.text
有什么建议么?