How to Configure Jira Library and get some Basic Data

by Owais Mushtaq

So far, in this series on Jira issue tracker we have seen how to get access tokens and consumer key in Jira. In this blog, we will learn how to configure Jira library so as to be able to get some basic data.

# The Consumer Key created while setting up the “Incoming Authentication” in
# JIRA for the Application Link.
CONSUMER_KEY = ‘12345’

# The contents of the rsa.pem file generated (the private RSA key)

RSA_KEY = self.read('core/management/commands/jira.pem')

# The URLs for the JIRA instance

jira = JIRA(options={'server': settings.JIRA_SERVER}, oauth={ 'access_token': 'xQ283fxxxxxxxxxxxxxaKXZt9OiJ', 'access_token_secret': '2jLvwjmxxxxxxxxx7uxxxxxxNupBW', 'consumer_key': CONSUMER_KEY, 'key_cert': RSA_KEY })

In the below example we will try to get all the issues in a project,

projects = jira.projects()

#This returns a list of projects

for project in projects:
    print("KEY: ", project.key, "NAME: ", project.name)
    all_issues = jira.search_issues('project=' + str(project.key), maxResults=50)
for issue in issues: key = issue.key print("KEY: ",key)

Here you can get issue details of a project, example its key.

Leave a Reply

Your email address will not be published. Required fields are marked *

Tools & Practices

Tools and Technologies we use at Applied

Contact us now

Popular Posts