pycontribs / jira

Python Jira library. Development chat available on https://matrix.to/#/#pycontribs:matrix.org
https://jira.readthedocs.io
BSD 2-Clause "Simplified" License
1.96k stars 873 forks source link

AttributeError while creating Jira link: 'list' object has no attribute 'items' #918

Open mmm83 opened 4 years ago

mmm83 commented 4 years ago

Describe the bug We have an application which creates links in JIRA issues it stopped working since jira upgrade to version Jira v8.5.1

To Reproduce Steps to reproduce the behavior:

from jira import JIRA

options = {
            'server': <jira host url>,
            'rest_api_version': 'latest',
            'verify': False,
        }
jira = JIRA(options=options, basic_auth=(<user>, <password>), max_retries=1)
remote_link_dict = {
                'title': 'Google page',
                'url': "https://www.google.com"
            }
jira.add_simple_link(jira.issue(<issue id>), remote_link_dict)

Expected behavior Jira link is created without any error.

Stack Trace

Traceback (most recent call last):
  File "testScript.py", line 17, in <module>
    jira.add_simple_link(jira.issue("ISSUENAME-1234"), remote_link_dict)
  File "C:\Python37\lib\site-packages\jira\client.py", line 1792, in add_simple_link
    simple_link = RemoteLink(self._options, self._session, raw=json_loads(r))
  File "C:\Python37\lib\site-packages\jira\resources.py", line 627, in __init__
    self._parse_raw(raw)
  File "C:\Python37\lib\site-packages\jira\resources.py", line 406, in _parse_raw
    dict2resource(raw, self, self._options, self._session)
  File "C:\Python37\lib\site-packages\jira\resources.py", line 1043, in dict2resource
    for i, j in raw.items():
AttributeError: 'list' object has no attribute 'items'

Version Information Python Interpreter: Python 3.7.2 jira-python: 2.0.0 (also tested on 3.0a2) OS: Tested on Windows and Linux

LuckyLuck11 commented 4 years ago

adding a simple link with the newest version jira v.8.8.0 and Jira v8.5.1 works well in case when new empty instance of jira is used in my test environment. For some reason bug above is still valid for particular business instance of jira as user mmm83 has reported.

To Reproduce Exactly the same as above.

Version Information Windows Python 3.6.8 setuptools<45.0.0 jira == 2.0.0 paramiko == 2.1.6 pygit2 == 0.28.2 pyinstaller == 3.5 requests == 2.22.0