Skip to content

Commit 2c71598

Browse files
authored
Merge branch 'iam-veeramalla:main' into main
2 parents 2c55431 + 7a2982a commit 2c71598

File tree

8 files changed

+416
-17
lines changed

8 files changed

+416
-17
lines changed

Day-14/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Github-JIRA intergration Project

Day-14/examples/create-jira.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# This code sample uses the 'requests' library:
2+
# http://docs.python-requests.org
3+
import requests
4+
from requests.auth import HTTPBasicAuth
5+
import json
6+
7+
url = "https://veeramallaabhishek.atlassian.net/rest/api/3/issue"
8+
9+
API_TOKEN = ""
10+
11+
auth = HTTPBasicAuth("", API_TOKEN)
12+
13+
headers = {
14+
"Accept": "application/json",
15+
"Content-Type": "application/json"
16+
}
17+
18+
payload = json.dumps( {
19+
"fields": {
20+
"description": {
21+
"content": [
22+
{
23+
"content": [
24+
{
25+
"text": "My first jira ticket",
26+
"type": "text"
27+
}
28+
],
29+
"type": "paragraph"
30+
}
31+
],
32+
"type": "doc",
33+
"version": 1
34+
},
35+
"project": {
36+
"key": "AB"
37+
},
38+
"issuetype": {
39+
"id": "10006"
40+
},
41+
"summary": "First JIRA Ticket",
42+
},
43+
"update": {}
44+
} )
45+
46+
response = requests.request(
47+
"POST",
48+
url,
49+
data=payload,
50+
headers=headers,
51+
auth=auth
52+
)
53+
54+
print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))

Day-14/examples/list_projects.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This code sample uses the 'requests' library:
2+
# http://docs.python-requests.org
3+
import requests
4+
from requests.auth import HTTPBasicAuth
5+
import json
6+
7+
url = "https://veeramallaabhishek.atlassian.net/rest/api/3/project"
8+
9+
API_TOKEN=""
10+
11+
auth = HTTPBasicAuth("", API_TOKEN)
12+
13+
headers = {
14+
"Accept": "application/json"
15+
}
16+
17+
response = requests.request(
18+
"GET",
19+
url,
20+
headers=headers,
21+
auth=auth
22+
)
23+
24+
output = json.loads(response.text)
25+
26+
name = output[0]["name"]
27+
28+
print(name)

Day-15/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Github-JIRA intergration Project - (Part-2)

Day-15/examples/hello-world.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from flask import Flask
2+
3+
app = Flask(__name__)
4+
5+
@app.route('/')
6+
def hello_world():
7+
return 'Hello, World!'
8+
9+
if __name__ == '__main__':
10+
app.run("0.0.0.0")

Day-15/github-jira.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# This code sample uses the 'requests' library:
2+
# http://docs.python-requests.org
3+
import requests
4+
from requests.auth import HTTPBasicAuth
5+
import json
6+
from flask import Flask
7+
8+
app = Flask(__name__)
9+
10+
# Define a route that handles GET requests
11+
@app.route('/createJira', methods=['POST'])
12+
def createJira():
13+
14+
url = "https://veeramallaabhishek.atlassian.net/rest/api/3/issue"
15+
16+
API_TOKEN=""
17+
18+
auth = HTTPBasicAuth("", API_TOKEN)
19+
20+
headers = {
21+
"Accept": "application/json",
22+
"Content-Type": "application/json"
23+
}
24+
25+
payload = json.dumps( {
26+
"fields": {
27+
"description": {
28+
"content": [
29+
{
30+
"content": [
31+
{
32+
"text": "Order entry fails when selecting supplier.",
33+
"type": "text"
34+
}
35+
],
36+
"type": "paragraph"
37+
}
38+
],
39+
"type": "doc",
40+
"version": 1
41+
},
42+
"project": {
43+
"key": "AB"
44+
},
45+
"issuetype": {
46+
"id": "10006"
47+
},
48+
"summary": "Main order flow broken",
49+
},
50+
"update": {}
51+
} )
52+
53+
54+
response = requests.request(
55+
"POST",
56+
url,
57+
data=payload,
58+
headers=headers,
59+
auth=auth
60+
)
61+
62+
return json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": "))
63+
64+
if __name__ == '__main__':
65+
app.run(host='0.0.0.0', port=5000)

0 commit comments

Comments
 (0)