-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
38 lines (26 loc) · 1.05 KB
/
run.py
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
from flask import Flask, jsonify, request
import requests
import json
planner_patch_app = Flask(__name__)
@planner_patch_app.route('/', methods=['POST'])
def hello_world_post():
params = request.get_json()
headers = {
"Authorization": params["Authorization"],
"If-Match": params["If-Match"],
"Content-type": "application/json"
}
url = "https://graph.microsoft.com/v1.0/planner/tasks/" + params["TaskId"] + "/details"
description = "Update Request Type: " + params["RequestType"] + "\n" + "Update Request Details: " + params["RequestDetails"] + \
"\n\n\n" + "Generated By Kissflow "
payload = {
"description": description
}
r = requests.patch(url, data=json.dumps(payload), headers=headers)
return jsonify({"r": r.text, "result": str(len(params)) + " request params supplied. " + str(params)})
@planner_patch_app.route('/', methods=['GET'])
def hello_world_get():
return 'Hello World!'
if __name__ == '__main__':
planner_patch_app.debug = True
planner_patch_app.run()