-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheighth.py
50 lines (35 loc) · 1.03 KB
/
eighth.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
#!/usr/bin/env python
import datetime
import getpass
import os
import requests
USERNAME = os.getenv('USER')
PASSWORD = None
'''
def get_blocks(date):
auth = (USERNAME, PASSWORD)
r = requests.get('https://ion.tjhsst.edu/api/blocks', auth=auth)
if r.status_code != 200:
raise ValueError(r.text)
return r.json()['results']
def get_block_activities(block_id):
auth = (USERNAME, PASSWORD)
r = requests.get('https://ion.tjhsst.edu/api/blocks/{}'.format(block_id), auth=auth)
if r.status_code != 200:
raise ValueError(r.text)
'''
def main():
print('Username:', USERNAME)
# get password
global PASSWORD
PASSWORD = getpass.getpass()
today = datetime.datetime.now().date()
print('Today is', today)
auth = (USERNAME, PASSWORD)
r = requests.get('https://ion.tjhsst.edu/eighth/profile/32080', auth=auth)
print(r.text)
#block_list = get_blocks()
#for block in block_list:
# print(block['date'], block['block_letter'])
if __name__ == '__main__':
main()