-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateMeeting.py
More file actions
54 lines (36 loc) · 1.35 KB
/
createMeeting.py
File metadata and controls
54 lines (36 loc) · 1.35 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
import sys
import jwt
import http.client
import datetime
import json
# Go to
# Then get API Key, API Secret and insert below
api_key = 'p-zpPVCrQMy4SnOlAV9BGw'
api_sec = '8NWGe7uCQd8574r8EKpZJi3nrNRm3UPezoY7'
payload = {
'iss':api_key,
'exp': datetime.datetime.now() + datetime.timedelta(hours=2)
}
jwt_encoded = str(jwt.encode(payload, api_sec), 'utf-8')
conn = http.client.HTTPSConnection("api.zoom.us")
headers = {
'authorization': "Bearer %s" % jwt_encoded,
'content-type': "application/json"
}
def createMeeting(start_time, duration, topic, participants):
data = json.dumps({
"duration": duration,
"start_time": start_time,
"topic": topic,
})
conn.request("POST", "/v2/users/z5164086@student.unsw.edu.au/meetings", body=data, headers=headers)
res = conn.getresponse()
response_string = res.read().decode('utf-8')
response_obj = json.loads(response_string)
print(response_obj)
conn.request("GET", "/v2/meetings/" + str(response_obj['id']) + "/invitation", headers=headers)
res = conn.getresponse()
response_string = res.read().decode('utf-8')
response_obj = json.loads(response_string)
print(response_obj['invitation'])
createMeeting("2021-08-30T22:00:00Z", 60, "TestTopic", ["jamesclark@outlook.com.au"])