-->

Welcome to our Coding with python Page!!! hier you find various code with PHP, Python, AI, Cyber, etc ... Electricity, Energy, Nuclear Power

Wednesday, 4 November 2020

How do I access the hosted Jira API via python?

Standard basic authentication is now deprecated in Jira from June 2019.

An API key is required for basic authentication which now replaces the 'password' requirement. API key's can be 
generated from:  https://confluence.atlassian.com/cloud/api-tokens-938839638.html.

You should use the following format:

jira = JIRA(
basic_auth=(un, pwd),
options={
'server': server
}
)

You need to pass in the server details as a connection option when you are specifying basic_auth.

in the example above, un pwd and server are all string variables.


from jira import JIRA

def main():

   options = {'server': jiraURL}
   jira = JIRA(options, basic_auth=(jiraUserName, jiraPassword))
   issue = jira.issue('ESS-138581')

   print issue.fields.project.key
   print issue.fields.issuetype.name
   print issue.fields.reporter.displayName
   print issue.fields.summary
   print issue.fields.project.id

if __name__== "__main__" :
     main()

 

If you get handshake error [SSLV3_ALERT_HANDSHAKE_FAILURE]. Kindly install the following modules in python

  • pyOpenSSL
  • ndg-httpsclient
  • pyasn1

No comments:

Post a Comment

Thanks for your comments

Rank

seo