-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
48 lines (38 loc) · 1.04 KB
/
app.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
39
40
41
42
43
44
45
46
47
48
#!flask/bin/python
from flask import Flask, jsonify
import requests
app = Flask(__name__)
tasks = [
{
'id': 1,
'title': u'Buy groceries',
'description': u'Milk, Cheese, Pizza, Fruit, Tylenol',
'done': False
},
{
'id': 2,
'title': u'Learn Python',
'description': u'Need to find a good Python tutorial on the web',
'done': False
}
]
TOKEN = os.environ.get('OTHER', None)
@app.route('/')
def index():
return "Hello, World!"
@app.route('/todo/api/v1.0/tasks', methods=['GET'])
def get_tasks():
return jsonify({'tasks': tasks})
@app.route('/slack-invite/, methods=['POST'])
def invite_slack():
if not request.json or not 'address' in request.json:
abort(400)
data = {}
data["email"] = request.json.address
data["token"] = requests.json.address
data["set_active"] = true
payload = jsonify(data)
response = requests.post('https://wwchsv.slack.com/api/users.admin.invite/', data = payload)
response.text
if __name__ == '__main__':
app.run(debug=True)