尝试使用Jira Python API获取数据时出现错误[AttributeError:'bool'对象没有属性'error']

卡马尔

python --version
Python 3.8.0

只是试图解决一些问题。

from jira import JIRA

def main():
   options = {'server':"https://jira.test.com/" }
   jira = JIRA(options, basic_auth=('username', 'password'))
   issue = jira.issue('XXXX-10085')
   print (issue.fields.project.key)
   print (issue.fields.issuetype.name)
   print (issue.fields.reporter.displayName)
   print (issue.fields.summary)
   print (issue.fields.project.id)

if __name__== "__main__" :
     main()

但我得到错误:

WARNING:root:Bug https://jira.atlassian.com/browse/JRA-59676 trying again...
WARNING:root:Bug https://jira.atlassian.com/browse/JRA-59676 trying again...
WARNING:root:Bug https://jira.atlassian.com/browse/JRA-59676 trying again...
Traceback (most recent call last):
  File "/Users/syedahmed/ANACONDA/anaconda3/envs/jira/lib/python3.8/site-packages/jira/client.py", line 474, in __init__
    self._version = tuple(si['versionNumbers'])
KeyError: 'versionNumbers'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "jt.py", line 14, in <module>
    main()
  File "jt.py", line 5, in main
    jira = JIRA(options, basic_auth=('username', 'password'))
  File "/Users/syedahmed/ANACONDA/anaconda3/envs/jira/lib/python3.8/site-packages/jira/client.py", line 476, in __init__
    logging.error("invalid server_info: %s", si)
AttributeError: 'bool' object has no attribute 'error'

自从我查看源代码(client.py)以来,@ Prabhat似乎没有获得REST API的版本号。

 self.deploymentType = None
 470         if get_server_info:
 471             # We need version in order to know what API calls are available or not
 472             si = self.server_info()
 473             try:
 474                 self._version = tuple(si['versionNumbers'])
 475             except Exception as e:
 476                 logging.error("invalid server_info: %s", si)
 477                 raise e
 478             self.deploymentType = si.get('deploymentType')
 479         else:
 480             self._version = (0, 0, 0)

在浏览器中,打开https://jira.test.com/rest/api/2/issue/XXXX-10085时,我会获得正确的JSON

但是当我使用curl时,我得到了AUTHENTICATION_DENIED

$ curl -D- -X GET -H "Authorization: Basic base64encodedhash" -H "Content-Type: application/json" "https://jira.test.com/rest/api/2/issue/XXXX-10085"
HTTP/1.1 200
X-AREQUESTID: 1239x574427x1
X-ANODEID: node2
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: frame-ancestors 'self'
X-ASEN: SEN-6742665
Set-Cookie: JSESSIONID=487ECA3C5601199AB97294A8BA866151; Path=/; HttpOnly
X-Seraph-LoginReason: AUTHENTICATION_DENIED
Content-Type: text/html;charset=UTF-8
Content-Length: 0
Date: Tue, 31 Dec 2019 01:39:14 GMT
Set-Cookie: BIGipServerJIRA=67143434.36895.0000; path=/; Httponly; Secure
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
Set-Cookie: TS01dc5b77=015efd37d830c3fc1357c099281a755d6a9e2fc387d6a6c5af8aead0625e8a81e65afe21e442cd23510d7f30577b4ec345e82490c436146235e475a8d6f0a92a1e4159712c3ac6e13dbe26719fd07ac6ec48b466bd; Path=/

请记住,我正在对用户名:密码使用base64哈希

Prabhat Chandra

URL和用户凭据似乎没有错。请检查您尝试访问的服务器和凭据详细信息。

options = {'server':"https://jira.test.com/" }
jira = JIRA(options, basic_auth=('username', 'password'))

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Python 3:AttributeError:“模块”对象在终端中使用urllib时没有属性“ __path__”

Python-Kivy:AttributeError:“超级”对象在尝试获取self.ids时没有属性“ __getattr__”

python error AttributeError:'str'对象没有属性'setdefault'

使用Pyinstaller将PRAW python文件转换为exe时,出现“ AttributeError:'_ NotSet'对象没有属性'lower'”

python中的AttributeError:对象没有属性

AttributeError:'bool'对象没有属性'le'-pyqt-将文本放入python变量

无法使用python match()解析字符串-获取错误AttributeError:'NoneType'对象没有属性'group'

使用Discord for python时,“ NoneType”对象没有属性“发送”

如何在加载模型时使用Tensorflow / Keras修复python中的'AttributeError:'list'对象没有属性'shape'错误

AttributeError:将函数“选择”移动到Django时,使用Selenium Python将“ WebElement”对象没有属性“ copy”错误

python AttributeError'dict'对象没有属性

使用带有假设的check()检查sat会引起AttributeError:'bool'对象没有属性'as_ast'

AttributeError:尝试在python中使用tensorflow实现卷积神经网络程序时,'dict'对象没有属性'train'错误

尝试从输入对象获取文本时为什么出现此错误:Tkinter AttributeError:CustomClass实例没有属性“ entry”?

Django:AttributeError:“ bool”对象没有属性“ expire”

Python属性错误对象没有属性

尝试使用Boost :: Python将python对象加载到C ++中时出现“ AttributeError:'模块'没有属性'player'”

Python AttributeError:使用队列后,“列表”对象没有属性

平方根python错误bool对象没有属性'sqrt'

AttributeError:'bool'对象没有属性'count'

AttributeError:使用Python从AVRO读取时,'str'对象没有属性'decode'

Python:在尝试使用预测时获取 AttributeError: 'LogisticRegression' 对象没有属性 'classes_'

使用 Azure CLI 登录到 Azure 容器服务失败并显示错误“bool”对象没有属性“rstrip”

Python:AttributeError:'bool'对象没有'all'属性

Python - AttributeError:对象没有属性“tk”

使用 Panda AttributeError 的 Python 错误:“系列”对象没有属性“asType”

Python - 使用 Tkinter 的对象没有属性错误

Python-AttributeError: 'int' 对象在尝试调用 NetworkX 上的 GML 文件时没有属性 'decode'"

Scikit-learn: AttributeError: 'bool' 对象没有属性 'any'