Last Updated : 17 May, 2022
Install jira using the command:
pip install jira
Now open a python compiler (for example anaconda) and import the Jira library that you just installed.
from jira
import JIRA
Construct a Client-instance that will request your required data from the Jira server. This will require the Server name (to which the client will send its data request) given by your Domain name. Moreover, the client will require authentication parameters like your email id and the token created in Step 1.
jiraOptions = {
'server': "https://zxxxxxxpython.atlassian.net"
}
Now, pass the authentication parameters to configure the Client instance:
jira = JIRA(options = jiraOptions, basic_auth = ("abxxxxxxh@gmail.com", "dejxxxxxxxxxxxxxxxxxxx7E"))
Another option is to call only a single instance from your project. This requires the following code:
singleIssue = jira.issue('MED-1')
print('{}: {}:{}'.format(singleIssue.key,
singleIssue.fields.summary,
singleIssue.fields.reporter.displayName))
Use the following code to Import the modules important for this process.
import requests
from requests.auth
import HTTPBasicAuth
import json
import pandas as pd
This library eases the use of the Jira REST API from Python and it has been used in production for years.,Python library for interacting with JIRA via REST APIs.,When updating interactions with the Jira REST API please refer to the documentation below. We aim to support both Jira Cloud and Jira Server / Data Center.,Atlassian for developing such a powerful issue tracker and for providing a free on-demand Jira instance that we can use for continuous integration testing.
Feeling impatient? I like your style.
from jira import JIRA jira = JIRA('https://jira.atlassian.com') issue = jira.issue('JRA-9') print(issue.fields.project.key) # 'JRA' print(issue.fields.issuetype.name) # 'New Feature' print(issue.fields.reporter.displayName) # 'Mike Cannon-Brookes [Atlassian]'
- Example for VSCode on Windows :
{
"name": "Pytest",
"type": "python",
"request": "launch",
"python": ".tox\\py39\\Scripts\\python.exe",
"module": "pytest",
"env": {
"CI_JIRA_URL": "http://localhost:2990/jira",
"CI_JIRA_ADMIN": "admin",
"CI_JIRA_ADMIN_PASSWORD": "admin",
"CI_JIRA_USER": "jira_user",
"CI_JIRA_USER_FULL_NAME": "Newly Created CI User",
"CI_JIRA_USER_PASSWORD": "jira",
"CI_JIRA_ISSUE": "Task",
"PYTEST_TIMEOUT": "0", // Don't timeout
},
"args": [
// "-v",
"--no-cov", // running coverage affects breakpoints
"tests/resources/test_attachment.py"
]
}
This library eases the use of the Jira REST API from Python and it has been used in production for years.,As this is an open-source project that is community maintained, do not be surprised if some bugs or features are not implemented quickly enough. You are always welcomed to use BountySource to motivate others to help.,Atlassian for developing such a powerful issue tracker and for providing a free on-demand Jira instance that we can use for continuous integration testing.,By default only the basic library dependencies are installed, so if you want to use the cli tool or other optional dependencies do perform a full installation using pip install jira[opt,cli,test]
Jannik Meinecke (<jannik.meinecke@mercedes-benz.com>) on behalf of MBition GmbH.
https://github.com/mercedes-benz/foss/blob/master/PROVIDER_INFORMATION.md
Co-authored-by: Martin Locklear <martin@martinlocklear.com>
from jira import JIRA jira = JIRA('https://jira.atlassian.com') issue = jira.issue('JRA-9') print(issue.fields.project.key) # 'JRA' print(issue.fields.issuetype.name) # 'New Feature' print(issue.fields.reporter.displayName) # 'Mike Cannon-Brookes [Atlassian]'
{
"name": "Pytest",
"type": "python",
"request": "launch",
"python": ".tox\\py39\\Scripts\\python.exe",
"module": "pytest",
"env": {
"CI_JIRA_URL": "http://localhost:2990/jira",
"CI_JIRA_ADMIN": "admin",
"CI_JIRA_ADMIN_PASSWORD": "admin",
"CI_JIRA_USER": "jira_user",
"CI_JIRA_USER_FULL_NAME": "Newly Created CI User",
"CI_JIRA_USER_PASSWORD": "jira",
"CI_JIRA_ISSUE": "Task",
"PYTEST_TIMEOUT": "0", // Don't timeout
},
"args": [
// "-v",
"--no-cov", // running coverage affects breakpoints
"tests/resources/test_attachment.py"
]
}
The reference documentation for the Jira Server platform REST API is here: Jira Server platform REST API. If you've never used the Jira REST APIs before, we recommend that you also read the overview About the Jira REST APIs.,This performs a GET on the issue, checks for a successful response, and then parses the JSON response into a Python dictionary. The filters=\[auth\] line is how you tell restkit to perform BASIC Authentication. Later on, you'll reach into this Python dictionary to grab the data you want for your work.,The Jira REST API allows you to discover the fields and data available and required for creating issues. For this we use the createmeta resource.,The Jira REST API allows you to discover the fields and data available and required for creating issues. For this, we use three different resources.
1 2
1 2
http: //localhost:8080/rest/api/2/issue/createmeta
1 2
1 2
http: //localhost:8080/rest/api/2/issue/createmeta?projectKeys=JRA&issuetypeNames=Bug&expand=projects.issuetypes.fields
1 2
1 2
http: //localhost:8080/rest/api/2/project
1 2
1 2
http: //localhost:8080/rest/api/2/issue/createmeta/{projectIdOrKey}/issuetypes
1 2
1 2
http: //localhost:8080/rest/api/2/issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}
1 2
1 2
curl\
-
D - \
-u charlie: charlie\ -
X POST\
--data {
see below
}\ -
H "Content-Type: application/json"\
http: //localhost:8080/rest/api/2/issue/