Browse Source

Last janky version

master
Raphael Roberts 6 years ago
parent
commit
4d62752181
  1. 13
      __init__.py
  2. 820
      schedule.html
  3. 34
      test.py

13
__init__.py

@ -1,13 +1,16 @@
from gcalendar import api
from gcalendar import calendar_api
import json
import pprint
api = api(r'api_info\client_secret.json','api_info')
api = calendar_api("class", r"api_info\client_secret.json", "api_info")
cals = api.get_calendars()
cal = next(filter(lambda cal: cal['id'] == api.ids['school schedule'],cals))
with open('classes.json') as file:
cal = next(
filter(lambda cal: cal["id"] == api.ids["Raphael's School Schedule".lower()], cals)
)
with open("classes.json") as file:
bodies = json.load(file)
for body in bodies:
# body['colorId'] = cal['colorId']
# pprint.pprint(body)
# input()
api.create_event('school schedule',body)
api.create_event("Raphael's School Schedule".lower(), body)

820
schedule.html
File diff suppressed because it is too large
View File

34
test.py

@ -1,27 +1,31 @@
from body_create import rrule_former,create_body
from body_create import rrule_former, create_body
import datetime
def json_dump(*args):
pass
def test_rrule():
#test
# test
now = datetime.datetime.now()
from munch import Munch
test_obj = Munch(
days=[1,3,5],
time_range=[
now.time(),
(now+datetime.timedelta(seconds=50*60)).time()
],
date_range=[
now.date(),
(now+datetime.timedelta(days=20)).date()
],
)
days=[1, 3, 5],
time_range=[now.time(), (now + datetime.timedelta(seconds=50 * 60)).time()],
date_range=[now.date(), (now + datetime.timedelta(days=20)).date()],
)
test_result = rrule_former(test_obj)
return locals()
def testclass_obj2body():
with open('classes.pkl','rb') as file:
with open("classes.pkl", "rb") as file:
classes = pickle.load(file)
test_result = list(filter(bool,map(create_body,classes)))
test_result = list(filter(bool, map(create_body, classes)))
return test_result
if __name__ == "__main__":
json_dump(testclass_obj2body())
json_dump(testclass_obj2body())
Loading…
Cancel
Save