0

我正在尝试在 Python-jira 的帮助下进行基本身份验证并编写了以下代码

from jira import JIRA
SERVER="https://jira.company.com"
user = user@company.com
apikey='api_token'

class create_issue:

    def check_authentication(self):
        print("inside the check authentication method@@@@@@@")
        jira = JIRA(options, basic_auth=(user, apikey)) # username is email-ID and apikey is the JIRA api-token

ci= create_issue()
ci.check_authentication()

我收到以下错误

WARNING:root:Got recoverable error from GET https://jira.company.com/rest/api/2/serverInfo, will retry [1/3] in 13.772170596345521s. Err: 401 

之前尝试使用不推荐使用的用户名和密码,后来更改为 api_key 而不是密码。但仍然遇到问题。任何人都可以帮助解决这个问题。当我使用网站使用相同的身份验证时,它正在工作。

谢谢, 普尼斯

4

1 回答 1

-1

他们的文档表明您在使用基本身份验证时应该使用用户名和密码,而不是 apikey。

https://developer.atlassian.com/server/jira/platform/basic-authentication/

在引入课程之前,坚持一些简单的事情以确保它有效。

from jira import JIRA

SERVER="https://jira.company.com"

user = "username"
password = "password"


jira = JIRA(SERVER, basic_auth=(user, password))
于 2020-03-27T22:09:08.953 回答