Skip to main content

Python Wrapper for Atlassian REST API

Project description

Python Wrapper for Atlassian REST API

PyPI CodeFactor PyPI - Downloads

What is this?

This is a package wrapper of Atlassian REST API written in Python, currently, it only supports JIRA and Bitbucket.

This package was created to simplify the implementation of integration with JIRA and Bitbucket.

QuickStart

Install from PyPI

# install
$ pip install atlassian-api-py

# upgrade to latest
$ pip install atlassian-api-py --upgrade

Establish connection

Connect with username and password

>>> from atlassian import Jira
>>> jira = Jira(url='https://jira.company.com', username="username", password="password")

Or connect with token

>>> from atlassian import Jira
>>> jira = Jira(url='https://jira.company.com', token="yourToken")

Or write your credentials in a configuration file config.ini, and get the credential though the configuration file.

[jira]
url = https://jira.company.com
username = username
password = password
# Or
token = yourToken
>>> import configparser
>>> config = configparser.ConfigParser()
>>> config.read('config.ini')

>>> jira_url = config['jira']['url']
>>> jira_usr = config['jira']['username']
>>> jira_psw = config['jira']['password']
>>> jira_token = config['jira']['token']

Get fields

Next, you can get the issue's fields as follow:

>>> issue = jira.issue('TEST-1')
>>> print(issue.fields.status.name)
Triage
>>> print(issue.fields.description)
this is a demo jira ticket
>>> print(issue.fields.status.name)
Triage
>>> print(issue.fields.issuetype.name)
Bug

More fields

>>> print(issue.id)
1684517
>>> print(issue.key)
TEST-1
>>> print(issue.fields.assignee.key)
xpshen
>>> print(issue.fields.summary)
Jira REST API Unit Test Example
>>> ...

Unittest and Coverage

Run unittest

cd tests
python -m unittest

Run coverage

cd tests
coverage run -m unittest
coverage report -m              # to report on the results
coverage html                   # to get annotated HTML

Changelog

See CHANGELOG

FAQ

Q1: Which Jira/BitBucket version I used to develop?

For Jira I used Jira v8.5.9 and Jira Cloud.

For BitBucket I used Bitbucket v5.13.1. not support Bitbucket cloud for now.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

atlassian_api_py-0.5.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file atlassian_api_py-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for atlassian_api_py-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6d24ec98346ad785f7c4e651c7bbe5fa422bb4e4e1d643c8e68c0eadf13386b6
MD5 44d13af4f029f36d1c9e1305cf090ddf
BLAKE2b-256 a9f3eb4f6d4787bd9e2f7c27bb9ed6034bc59cc2781752c91671faed84ae7ef8

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page