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

I need a help in extending my python REST API script?

kumar August 8, 2024

 

 

Hi all

I have a small Python script for REST API here.

The purpose of script is to access the jira project and access the each issue within jira project.

# This code sample uses the 'requests' library:

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

import requests

from requests.auth import HTTPBasicAuth

import json

print("url")

url = "https://domain-name.atlassian.net/rest/api/2/project/search"

print(" url is done")

auth = HTTPBasicAuth("gmail_id@gmail.com", "API-TOKEN")

print("authenticated")

headers = {

  "Accept": "application/json"

}

print("headers  ")

response = requests.request(

   "GET",

   url,

   headers=headers,

   auth=auth

)

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

Now I need to access the project. let's say project name "JiraRESTAPICheck".

Then Access all the issues in the project "JiraRESTAPICheck", after accessing each issue,

- check for attachment with specific extensions(let's say, .md extension) and if the specific extension file present in the issue, do not do anything, if the file is not present, reject the issue.

Can you help me with above things please?

Thanks in advance

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events