forked from iam-veeramalla/python-for-devops
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub-jira.py
More file actions
65 lines (54 loc) · 1.49 KB
/
github-jira.py
File metadata and controls
65 lines (54 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# This code sample uses the 'requests' library:
# http://docs.python-requests.org
import requests
from requests.auth import HTTPBasicAuth
import json
from flask import Flask
app = Flask(__name__)
# Define a route that handles GET requests
@app.route('/createJira', methods=['POST'])
def createJira():
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": "Order entry fails when selecting supplier.",
"type": "text"
}
],
"type": "paragraph"
}
],
"type": "doc",
"version": 1
},
"project": {
"key": "AB"
},
"issuetype": {
"id": "10006"
},
"summary": "Main order flow broken",
},
"update": {}
} )
response = requests.request(
"POST",
url,
data=payload,
headers=headers,
auth=auth
)
return json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": "))
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)