Can we utilize python for scripting or automation in Jira?
Asked by Shib Saha:

Hi Everyone,

In our Jira admin team we want to on-board a Python developer for some other project but we want to him work in Jira team as well for scripting and automation part.

My question is "can we use python as an scripting language for automation or data flow in jira"?? if yes we can utilize the same resource for both purpose.

Please let us know if anyone is already using python for scripting in jira or know how to do it.

Please also let us know what should be the setup for using python as scripting language in Jira like any additional add-on for jira is required or can be done with jira only.

Thanks a lot in advance.

Regards,  
Shib


Answers:
author: Mykenna Cepek
body: You can use the [Jira REST API](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/) from most any language, including python.

The built-in Jira Automation, however, doesn't support embedded scripting.


author: Erin Quick-Laughlin
body: Hi Shib,

I don't know if this is the only answer, but you could use Python if you ran it as a web service, and use the Jira Automation component **Send web request** in your flow. The response is available as part of the {{webResponse}} specifically {{webResponse.body}}.

Specifics are here: <https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828>

Erin

comments: author: Mykenna Cepek
body: Good point, [@Erin Quick-Laughlin](/t5/user/viewprofilepage/user-id/4299733). Jira Automation can send web requests *outbound* . So this approach can be used for "data flow" *from* Jira*to* a custom web service.

But this functionality doesn't support the "use \[of\] python as \[a\] scripting language for automation" as noted in the original post. Maybe it helps with part of what [@Shib Saha](/t5/user/viewprofilepage/user-id/3999424) is trying to do, though!


author: Darryl Lee
body: There's a few Python REST API wrapper packages, but I can't vouch for how well they work.

This one is only for Jira, and looks well-maintained:

<https://github.com/pycontribs/jira/>

This one covers multiple Atlassian products, but I'm not sure if it's as well-maintained:

<https://github.com/atlassian-api/atlassian-python-api>

If you're more of a DIY person, here's some examples that include all the hairy details about auth, etc:

<https://www.opentechguides.com/how-to/article/python/185/jira-python-rest.html>


author: Prasad Prabhu
body: Hi [@Shib Saha](/t5/user/viewprofilepage/user-id/1127971)

Can you explain what your use is a little more? Are you trying to invoke Jira APIs from inside a python script? If so, the answers above are good pointers to get started.

If you are trying to have a shell or python script invoked as an automation script I don't think this exists at the moment. I am building a Jira app that will allow this to happen. If you are interested, please let me know. I'd be happy to help!

Happy automating!


author: Sedera Randria
body: Hi [@Shib Saha](/t5/user/viewprofilepage/user-id/3999424)

For several year now, we use Python scripts + [Jira REST API](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/) to automatically create tasks when onboarding new people. Then, Jira Automation updates tickets with additional details. Great combination.

Excel/VBA would have been more relevant to simply push a table into Jira, but I guess we are using Python for the same reason as you :-)


Tags: cloud

jira-software

script