嘿,我是Jira和python的初学者,我想对Jira和python进行身份验证。 Cookie和基本身份验证正常工作,但我想对Cookie身份验证和您的 验证码(您的访问令牌)。因此,您使用用户名-密码+令牌登录,还应使用Cookie转移我页面上的订单。这可能吗? 这是库: https://jira.readthedocs.io/en/master/
这里有一些测试代码,但仅使用cookie auth,我使用了flask:
from jira import JIRA
from flask import Flask, request
import re
# By default, the client will connect to a JIRA instance started from the Atlassian Plugin SDK
# (see https://developer.atlassian.com/display/DOCS/Installing+the+Atlassian+Plugin+SDK for details).
app = Flask(__name__)
options = {"server": "http://testsite.com/" }
jira = JIRA(auth=("admin", "caetlw6yr"), options=options)
print(jira)
@app.route('/')
def hello():
return "<html><form method='post' action='/create'><input type='text' id='name' name='name'><input type='submit' value='senden'></form></html>"
@app.route('/create', methods=['POST'])
def create():
name = request.form['name']
print(name)
new_issue = jira.create_issue(project='HIER', summary=name,
description='Look into this one', issuetype={'name': 'Task'})
return "Issue "+ str(new_issue) + " created"
if name == '__main__':
app.run(host='0.0.0.0')