Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,455,550
Community Members
 
Community Events
175
Community Groups

Atlassian Python API's

Hi Community,

The article here explained how to create a token in your Atlassian Account

To get started on APIs - Here's the Guide -> Link

In this article let us look at the Atlassian API using Python and the various approaches to using Python Modules to authenticate with Atlassian Account and interact with the APIs

One of the Modules I occasionally use is the atlassian-python-api module

https://atlassian-python-api.readthedocs.io

Install the atlassian-python-api module

pip install atlassian-python-api

Below is the sample code to authenticate to Atlassian Account where we mention the site, email as username, password, and cloud option as 'True'

from atlassian import Jira

jira = Jira(

    url='https://your-site.atlassian.net',

    username='email',

    password='token',

    cloud=True)


jql_request ='project = WSP AND issuetype = Story'

# '"epic link" = WSP-144'

issues = jira.jql(jql_request)

print(issues)

The methods we extract the data from Cloud are extensive and methods are flexible

Below is another example of the abstract way to get the data

# This code sample uses the 'requests' library:

# http://docs.python-requests.org

import requests

from requests.auth import HTTPBasicAuth

import json

import base64

url = "https://your-site.atlassian.net/rest/api/3/issue/WSP-70"

credentials = "Basic " + base64.b64encode("email:token".encode("ascii")).decode("ascii")

headers = {

   "Accept": "application/json",

   "Authorization": credentials

}

response = requests.request(

   "GET",

   url,

   headers=headers

)

print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))

There are other modules as well one such popular is https://jira.readthedocs.io/installation.html

Do let us know how you are using Jira modules or Atlassian Python Modules to Interact with Atlassian Sites

Thanks,
Pramodh

2 comments

Have you seen any differences in using the various Python libraries to work with the Atlassian REST APIs, particularly for Jira?

Like William Kennedy likes this

can you tell me how to add label for the jira ticket ? 

Comment

Log in or Sign up to comment
TAGS

Atlassian Community Events