我想用python-jira更改jira问题状态.python-jira API是http://jira-python.readthedocs.org/en/latest/.我找不到任何方法来执行此操作.我试图使用issue.update(status="Closed").但它没有用 .我在https://developer.atlassian.com/display/JIRADEV/Issue+status+and+workflow中找到了问题状态和工作流程.但我还是不知道是什么要做什么.任何人都可以帮助我吗?
我试图通过谷歌登录使用python脚本验证jira.我正在使用jira python图书馆.
我尝试使用basic_auth但由于我的帐户是通过gmail注册的,因此失败并显示错误.
jira=JIRA(options,basic_auth=(values['USERNAME'],values['PASSWORD']));
Run Code Online (Sandbox Code Playgroud) 因此,我使用 JIRA-Python 模块连接到我公司的 JIRA 实例,它要求我为此传递证书和密钥。但是,使用 OpenSSL 模块,我无法读取本地证书和密钥来将其传递给请求。
阅读代码如下
import OpenSSL.crypto
c = open('/Users/mpadakan/.certs/mpadakan-blr-mpsot-20160704.crt').read()
cert = OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_PEM, c)
Run Code Online (Sandbox Code Playgroud)
我得到的错误是
Traceback (most recent call last):
File "flaskApp.py", line 19, in <module>
cert = OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_PEM, c)
TypeError: must be X509, not str
Run Code Online (Sandbox Code Playgroud)
有人可以告诉我如何将本地 .crt 和 .key 文件读入 x509 对象吗?
所以,我编写了通过 python 库 atlassian_python_api 与 Jira api 交互的 python 代码
from atlassian import Jira
jira = Jira(
url="https://jira.example.com/",
username='gonchik.tsymzhitov',
password='admin')
jira.issue_create(fields={
'project': {'key': 'TEST'},
'issuetype': {
"name": "Task"
},
'summary': 'test rest',
'description': 'rest rest',
})
Run Code Online (Sandbox Code Playgroud)
使用密钥 TEST-2045 创建问题后(数字 2045 是自动生成的)。
问题是:如何插入自己的问题编号?例如,TEST-15 ?
我正在尝试使用代理通过 python-jira 连接:
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)
Run Code Online (Sandbox Code Playgroud)
回溯错误:
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
???
_ _ _ _ …Run Code Online (Sandbox Code Playgroud) 我已经完成了 pip install jira
但是当我运行以下命令时,它会导致ImportError失败:无法导入名称JIRA
import re
from jira import JIRA
jira = JIRA('https://issues.net')
# all values are samples and won't work in your code!
key_cert_data = None
key_cert_file = "cert/jiraprivatekey.pub"
with open(key_cert, 'r') as key_cert_file:
key_cert_data = key_cert_file.read()
Run Code Online (Sandbox Code Playgroud) 我在为 python 使用 jira 库时遇到了这个问题。尽管为基本身份验证设置了适当的参数,但我得到以下信息:
异常被忽略:<绑定方法魔术。德尔文件“/home/keckj/.local/lib/python3.6/site-packages/magic.py”,线路129,中:在0x7f2a4e5ff128 <magic.Magic对象>>回溯(最近通话最后一个)的德尔 如果self.cookie 和 magic_close: AttributeError: 'Magic' 对象没有属性 'cookie'
这是一个快速片段:
from jira import JIRA
user = 'xxxx.xxxxx@xxxxxx.com'
apikey = 'xxxxxxxxxxxxxxxxxxxxx'
jira_server = 'https://xxxxxxxxxx.jira.com'
options = {'server': jira_server}
jira = JIRA(options, basic_auth=(user,apikey))
issue = jira.issue("KEY-123")
issue_summary = issue.fields.summary
issue_description = issue.fields.description
print('JIRA ISSUE SUMMARY: %s' %str(issue_summary))
print('JIRA ISSUE DESCRIPTION: %s' %str(issue_description))
Run Code Online (Sandbox Code Playgroud)
我已经通过谷歌挖掘了几个方向,但一直很短:
我正在尝试使用 Jira 的 python API 将问题分配给史诗。从文档中,我发现 GreenHopper 类中有一个 add_issues_to_epic 方法,但它似乎对我不起作用。到目前为止,我有以下内容
from jira.client import JIRA
from jira.client import GreenHopper
jira = JIRA(options, basic_auth=(username, password))
greenhopper = GreenHopper(options, basic_auth=(username, password))
epicLink = 'IR-345'
issuesToAdd = ['IR-1459']
greenhopper.add_issues_to_epic(epicLink, issuesToAdd)
Run Code Online (Sandbox Code Playgroud)
但这给了我一个错误,即找不到 GreenHopper 类的 add_issues_to_epic。我试过 jira.add_issues_to_epic(epicLink, issuesToAdd),但这给了我同样的错误。
我究竟做错了什么?
如何使用 jira-python 库从工作日志中获取问题所花费的分钟数?
使用 jirashell,我发现问题具有属性 issue.fields.worklog,但是当我尝试在我的 python 代码中访问它时,我收到错误:AttributeError: type object 'PropertyHolder' has no attribute 'worklog'。
如果我创建一个 jira 客户端并在我的 python 代码中执行 jira_client.worklogs(ticket.key),它会返回一个工作日志列表及其 ID,但我不知道如何处理它。我在文档中看到有一个 worklog() 函数,它接收问题 id 和工作日志 id,但我不明白它返回什么以及我将如何使用它/如果它是我正在寻找的。
当我尝试在 JIRA 中的自定义字段上设置值时遇到问题,它返回此错误:
File "c:\python27\lib\site-packages\jira\resilientsession.py", line 45, in raise_on_error
r.status_code, error, r.url, request=request, response=r, **kwargs)
JIRAError: JiraError HTTP 400
text: Operation value must be a string
url: http://iasp091x.ia.ro.conti.de:8080/rest/api/2/issue/31424
response headers = {'X-AUSERNAME': 'continental', 'X-ASEN': 'SEN-5132028', 'X-Content-Type-Options': 'nosniff', 'Content-Encoding': 'gzip', 'Transfer-Encoding': 'chunked', 'X-Seraph-LoginReason': 'OK', 'Vary': 'User-Agent', 'X-AREQUESTID': '850x418015x3', 'X-ASESSIONID': 'gv7hra', 'Connection': 'close', 'Cache-Control': 'no-cache, no-store, no-transform', 'Date': 'Mon, 01 Feb 2016 12:10:49 GMT', 'Server': 'Apache-Coyote/1.1', 'Content-Type': 'application/json;charset=UTF-8'}
response text = {"errorMessages":[],"errors":{"customfield_11301":"Operation value must be a string"}}
Run Code Online (Sandbox Code Playgroud)
我使用的代码是这样的:
new_issue = jira.create_issue(project='PT', summary=issue_summary, …Run Code Online (Sandbox Code Playgroud) python-jira ×10
jira ×8
python ×8
oauth ×1
pyopenssl ×1
python-2.7 ×1
python-3.7 ×1
python-3.x ×1