API import issue when the field is empty

I am using the JIRA API to pull ticket details and put it in a separate database that I can connect Tableau to.

My problem is that when pulling in a ticket details (using python) where e.g. it has no priority, that I get an error.

How do I get around that error? How can I handle this error?

 

Just currently testing by printing the details on-screen:

 

for issue in issues:
if verbose:
            print( "issue.key: ", issue.key );
            print( "issue.fields.project.id: ", issue.fields.project.id );

The error I get is: 

cursor.execute(sql_stmt, (issue.key, issue.fields.issuetype.name, issue.fields.project.name, issue.fields.summary, issue.fields.updated,issue.fields.priority.name))
AttributeError: type object 'PropertyHolder' has no attribute 'priority

 

 

1 answer

The following worked for me:

if verbose:
try:
print( "issue.key: ", issue.key );
print( "issue.fields.project.id: ", issue.fields.project.id );
except AttributeError:
 key = None

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted an hour ago in United States

Topic Tuesday: What's your favorite topic?

Good morning All, Our goal is to get you into the habit of while enjoying your favorite morning drink you are checking the NOVA "space" for topics and comments. Your input is really needed and...

11 views 1 0
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you