-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
51 lines (42 loc) · 1.47 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
49
50
51
import asyncio
import webbrowser
from datetime import datetime
import json
import requests
class App:
def __init__(self, user):
global url
self.session_id = user.json()["session_id"]
self.current_category = user.json()["current_category"]
self.meetings = requests.get(url + "/schedule/" + str(self.session_id)).json()["data"]
async def enter_zoom(self):
current_time = datetime.now()
if current_time.weekday() == 6:
weekday = "0"
else:
weekday = str(current_time.weekday() + 1)
for meeting in self.meetings[self.current_category]:
if meeting["time"] == f"{current_time.hour}:{current_time.minute}" and weekday in meeting["repeating-days"]:
id = meeting["id"]
pwd = meeting["pw"]
uname = meeting["nickname"]
webbrowser.open(f"zoommtg://zoom.us/join?action=join&confno={id}&pwd={pwd}&uname={uname}")
async def main(self):
while True:
await asyncio.sleep(2)
await self.enter_zoom()
email = ""
pwd = ""
url = ""
with open('config.json') as config:
data = json.load(config)
email = data["email"]
pwd = data["pwd"]
url = data["url"]
user = requests.post(url + "/auth/login",json = {"email" : email,"pw" : pwd})
if not user.status_code == 200:
print("error: user not found")
app = App(user)
loop = asyncio.new_event_loop()
loop.create_task(app.main())
loop.run_forever()