Skip to content

Commit

Permalink
add files for day-14
Browse files Browse the repository at this point in the history
  • Loading branch information
iam-veeramalla committed Nov 27, 2023
1 parent 4126860 commit 70f5215
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
54 changes: 54 additions & 0 deletions Day-14/examples/create-jira.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This code sample uses the 'requests' library:
# http://docs.python-requests.org
import requests
from requests.auth import HTTPBasicAuth
import json

url = "https://veeramallaabhishek.atlassian.net/rest/api/3/issue"

API_TOKEN = ""

auth = HTTPBasicAuth("", API_TOKEN)

headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}

payload = json.dumps( {
"fields": {
"description": {
"content": [
{
"content": [
{
"text": "My first jira ticket",
"type": "text"
}
],
"type": "paragraph"
}
],
"type": "doc",
"version": 1
},
"project": {
"key": "AB"
},
"issuetype": {
"id": "10006"
},
"summary": "First JIRA Ticket",
},
"update": {}
} )

response = requests.request(
"POST",
url,
data=payload,
headers=headers,
auth=auth
)

print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
28 changes: 28 additions & 0 deletions Day-14/examples/list_projects.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This code sample uses the 'requests' library:
# http://docs.python-requests.org
import requests
from requests.auth import HTTPBasicAuth
import json

url = "https://veeramallaabhishek.atlassian.net/rest/api/3/project"

API_TOKEN=""

auth = HTTPBasicAuth("", API_TOKEN)

headers = {
"Accept": "application/json"
}

response = requests.request(
"GET",
url,
headers=headers,
auth=auth
)

output = json.loads(response.text)

name = output[0]["name"]

print(name)

0 comments on commit 70f5215

Please sign in to comment.