-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsyncServer.py
80 lines (50 loc) · 1.75 KB
/
syncServer.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import json
import multiprocessing
import time
from multiprocessing import Process
import processes
import pandas as pd
import requests
from passwords import secrets
from flask import Flask, Response, request
import syncTools
team_map = pd.read_csv('team_group_map.csv', dtype='str')
app = Flask(__name__)
doorflow_auth = requests.auth.HTTPBasicAuth(secrets['doorflow_auth_key'], 'x')
nexudus_auth = (secrets['nexudus_username'],
secrets['nexudus_password'])
pool = multiprocessing.Pool(5)
@app.route('/AccessControlUpdate', methods=['POST'])
def update_access_control():
coworker = request.json[0]
coworker_id = coworker['Id']
pool.apply_async(processes.updateProcess, (coworker_id,))
return Response(status=200)
@app.route('/InvoicePaid', methods=['POST'])
def invoice_paid():
coworker = request.json[0]
coworker_id = coworker['Id']
pool.apply_async(processes.updateProcess, (coworker_id,))
return Response(status=200)
@app.route('/InvoiceIssued', methods=['POST'])
def invoice_issued():
coworker = request.json[0]
coworker_id = coworker['Id']
pool.map(processes.updateProcess, (coworker_id,))
return Response(status=200)
@app.route('/MembershipExpired', methods=['POST'])
def expired_membership():
coworker = request.json[0]
coworker_id = coworker['Id']
pool.apply_async(processes.updateProcess, (coworker_id,))
return Response(status=200)
@app.route('/TeamUpdate', methods=['POST'])
def team_update():
team = request.json[0]
pool.apply_async(processes.update_team_members, (team,))
return Response(status=200)
@app.route('/Checkin', methods=['POST'])
def checkin_user():
return Response(status=200)
if __name__ == '__main__':
app.run(debug=True, port=5500)