Duplicate ticket created while run the python script

We can automation script which create jira from zendesk ticket. sometimes it creates multiple duplicate jira tickets and sometime it works perfectly.
Due to duplication of jira ticket , it creates confusion among developers
Please look at the script and let us know

We are using python library called “jira”

from jira import JIRA
from zenpy.lib.api_objects import CustomField, Comment
from jira.exceptions import JIRAError

viu_jira = {‘server’: ‘https://vuclipdev.atlassian.net’} # jira server URL

jira = JIRA(basic_auth=(str(jira_user), str(jira_password)),
options=viu_jira) # Jira connection object

summary = summary + " - ZendeskId: " + str(ticketid)

jiraid = jira.create_issue(project=‘VIUL2’, summary=str(summary),
description=desc, issuetype={‘name’: ‘Support Ticket’},
assignee={‘name’: reporter},
labels=[‘zendesk_esclation’, ‘Insup’],
priority={‘name’: priority})

please reply with proper solutions

Hi @MaheshSuthar - this is definitely something happening on your client side. A couple of things… that Python library isn’t published or supported by Atlassian. But, in any case, I don’t think it’s a matter of that library being faulty, because I just tested it, and was able to create issues without being duplicates created.

I ran the script with the same dependencies 15 times, and only have 15 issues (I added time.time() to the summary to distinguish between them).

@nmansilla Thank you for your response, duplicate creation of ticket is not occurred every time, sometime it create single ticket without duplication which is good but sometime it create multiple duplicate ticket, it can be 2,3,4
Can you help to resolve this problem


The only tip I can provide is that you should try to profile & debug your code to see if it’s executing multiple times. Since you’re depending on a library that you didn’t write, I’d debug at the library level and check where it’s executing the HTTP call repeatedly.

HI @nmansilla,
As per my observation, while creating duplicate record on same time.I passed two labels in jira but after creating, count of labels mention in duplicate jira tickets are different. so may be it is library level issue.

BTW @MaheshSuthar – if this is the Python library you’re using (https://github.com/pycontribs/jira), which I believe it is, you should know that it’s made for Jira Server. There are of course similarities between Jira Server REST APIs and those on Jira Cloud; however, over time, the APIs have diverged… so your mileage may vary.

I would not rely on that client library for a production app/integration for Jira Cloud.

I did find another (non-official) Python client library for Jira Cloud here: https://pypi.org/project/jira-cloud-python/

IMO, if you want total control and assurance that you’re doing it right, consider just using the requests library (https://pypi.org/project/requests/), and roll your own.