Python Atlassian REST API Wrapper
Project description
What is it?
The atlassian-python-api library provides a simple and convenient way to interact with Atlassian products (such as Jira Service management, Jira Software, Confluence, Bitbucket and apps Insight, X-Ray) using Python. It is based on the official REST APIs of these products, as well as additional private methods and protocols (such as xml+rpc and raw HTTP requests). This library can be used to automate tasks, integrate with other tools and systems, and build custom applications that interact with Atlassian products. It supports a wide range of Atlassian products, including Jira, Confluence, Bitbucket, StatusPage and others, and is compatible with both Atlassian Server and Cloud instances.
Overall, the atlassian-python-api is a useful tool for Python developers who want to work with Atlassian products. It is well-documented and actively maintained, and provides a convenient way to access the full range of functionality offered by the Atlassian REST APIs and made with love for Atlassian.
Documentation
How to Install?
From PyPI
$ pip install atlassian-python-api
From Source
Git clone repository
Use
pip install -r requirements.txtto install the required packagesor
pipenv install && pipenv install --dev
Examples
More examples in examples/ directory.
Here’s a short example of how to create a Confluence page:
from atlassian import Confluence
import requests
# If you want to use a session, you can create it like this:
session = requests.Session()
# and pass it to the Confluence constructor
confluence = Confluence(
url='http://localhost:8090',
username='admin',
password='admin',
session=session,)
status = confluence.create_page(
space='DEMO',
title='This is the title',
body='This is the body. You can use <strong>HTML tags</strong>!')
print(status)
Please, note Confluence Cloud need to be used via token parameter. And here’s another example of how to get issues from Jira using JQL Query:
from atlassian import Jira
import requests
session = requests.Session()
jira = Jira(
url='http://localhost:8080',
username='admin',
password='admin',
session=session) # Optional: use a session for persistent connections
JQL = 'project = DEMO AND status IN ("To Do", "In Progress") ORDER BY issuekey'
data = jira.jql(JQL)
print(data)
The traditional jql method is deprecated for Jira Cloud users, as Atlassian has transitioned to a nextPageToken-based pagination approach instead of startAt. Use enhanced_jql for improved performance and future compatibility.
from atlassian import Jira
import requests
session = requests.Session()
jira = Jira(
url='https://your-jira-instance.atlassian.net',
username='your-email@example.com',
password='your-api-token',
cloud=True, # Ensure this is set to True for Jira Cloud
session=session # Optional: use a session for persistent connections
)
JQL = 'project = DEMO AND status IN ("To Do", "In Progress") ORDER BY issuekey'
# Fetch issues using the new enhanced_jql method
data = jira.enhanced_jql(JQL)
print(data)
Also, you can use the Bitbucket module e.g. for getting project list
from atlassian import Bitbucket
import requests
session= requests.Session()
bitbucket = Bitbucket(
url='http://localhost:7990',
username='admin',
password='admin',
session=session)
data = bitbucket.project_list()
print(data)
Now you can use the Jira Service Desk module. See docs. Example to get your requests:
from atlassian import ServiceDesk
import requests
sd = ServiceDesk(
url='http://localhost:7990',
username='admin',
password='admin',
session=requests.Session())
data = sd.get_my_customer_requests()
print(data)
Using Insight (CMDB Tool for Jira):
from atlassian import Insight
import requests
session = requests.Session()
insight = Insight(
url='http://localhost:7990',
username='admin',
password='admin',
session=session)
data = insight.get_object(88)
print(data)
Using Xray (Test Management tool for Jira):
from atlassian import Xray
import requests
session = requests.Session()
xr = Xray(
url='http://localhost:7990',
username='admin',
password='admin',
session=session)
data = xr.get_tests('TEST-001')
print(data)
Using Bamboo:
from atlassian import Bamboo
import requests
session = requests.Session()
bamboo = Bamboo(
url='http://localhost:6990/bamboo/',
token="<TOKEN>",
session=session)
data = bamboo.get_elastic_configurations()
print(data)
If you want to see the response in pretty print format JSON. Feel free for use construction like:
from pprint import pprint
# you code here
# and then print using pprint(result) instead of print(result)
pprint(response)
How to contribute?
First of all, I am happy for any PR requests. Let’s fork and provide your changes :) See the Contribution Guidelines for this project for details on how to make changes to this library.
Credits
In addition to all the contributors we would like to thank these vendors:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file atlassian_python_api-4.0.7.tar.gz.
File metadata
- Download URL: atlassian_python_api-4.0.7.tar.gz
- Upload date:
- Size: 271.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d9cc6068b1d2a48eb434e22e57f6bbd918a47fac9e46b95b7a3cefb00fceacb
|
|
| MD5 |
02f50a1c00b19d3d751309ad6dd7f78c
|
|
| BLAKE2b-256 |
40e8f23b7273e410c6fe9f98f9db25268c6736572f22a9566d1dc9ed3614bb68
|
File details
Details for the file atlassian_python_api-4.0.7-py3-none-any.whl.
File metadata
- Download URL: atlassian_python_api-4.0.7-py3-none-any.whl
- Upload date:
- Size: 197.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46a70cb29eaab87c0a1697fccd3e25df1aa477e6aa4fb9ba936a9d46b425933c
|
|
| MD5 |
4c160e4b908e1465f63f2d8cce2279b5
|
|
| BLAKE2b-256 |
1d83e4f9976ce3c933a079b8931325e7a9c0a8bba7030a2cb85764c0048f3479
|