2 years ago
#26534
ajs
JIRA Python API return objects
The following code is not working for me. I returns an object, but then I cannot query the fields of the object, or the object is the wrong object type. Any suggestions would be appreciated. Environment : Anaconda Python, JIRA Cloud.
from jira.client import JIRA
import traceback
print("Start")
issue=None
def tryJIRAConnect(issue):
jira_options = {'server': 'https://xxx.atlassian.net/rest/api/2/serverInfo?'}
try:
jira = JIRA(options=jira_options, basic_auth=('xxx.xxx@xxx.com', 'xxxxxxxxxx'))
issue=jira.issue('xxxDEV-1')
print(f'Success : JIRA Issue is : {issue}')
return(issue)
except Exception as e:
print(e)
traceback.print_exc()
x = tryJIRAConnect(issue)
print(f'x is : {type(x)}')
try:
print(x.raw)
except Exception as e:
print(e)
traceback.print_exc()
It returns
Success : JIRA Issue is : <JIRA Issue at 2460259479664>
x is : <class 'jira.resources.Issue'>
{'baseUrl': 'https://xxx.atlassian.net', 'version': '1001.0.0-SNAPSHOT', 'versionNumbers': [1001, 0, 0], 'deploymentType': 'Cloud', 'buildNumber': 100187, 'buildDate': '2022-01-05T14:01:29.000+0100', 'serverTime': '2022-01-08T12:33:41.914+0100', 'scmInfo': '07b4f58ec2724461528057c7cbdf73a2f653f223', 'serverTitle': 'Jira', 'defaultLocale': {'locale': 'en_US'}}
python
python-jira
0 Answers
Your Answer