Skip to content

Instantly share code, notes, and snippets.

@modelmat
Last active April 13, 2023 08:06
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save modelmat/f73981a927e7eac4f90421b5a47ca8fd to your computer and use it in GitHub Desktop.
Save modelmat/f73981a927e7eac4f90421b5a47ca8fd to your computer and use it in GitHub Desktop.
A simple API for My Study Life application
{
"academic_years":[
{
"created_at":"2018-08-11T11:35:29",
"deleted_at":null,
"end_date":"2018-12-19",
"guid":"2adeab27-b77d-40e8-b5c6-48ff699833ef",
"holidays":[
],
"scheduling":{
"adjustments":[
],
"day_count":null,
"days":null,
"mode":"week_rotation",
"scope":"year",
"start_day":null,
"start_week":2,
"week_count":2
},
"school_id":null,
"start_date":"2018-01-29",
"terms":[
{
"end_date":"2018-04-13",
"guid":"c5a71392-0557-4bae-b5f9-227126a3a2cf",
"name":"Term 1",
"start_date":"2018-01-29"
}
],
"timestamp":1533990643.0,
"updated_at":"2018-08-11T12:30:41",
"user_id":4076037
}
],
"classes":[
{
"building":"The Big One",
"color":null,
"created_at":"2018-08-11T11:42:29",
"deleted_at":null,
"guid":"448bf5a8-857d-4a71-b6e9-813ed9a8c44f",
"module":null,
"room":"32",
"school_id":null,
"subject_guid":"31d1c839-6c32-4583-ab5b-f879813a6911",
"teacher_name":"Mrs Citizen",
"term_guid":null,
"times":[
{
"building":null,
"days":4,
"end_time":"12:12:00",
"guid":"690acea1-5b9d-e811-b4b0-000d3a2297c8",
"room":null,
"rotation_days":null,
"rotation_week":1,
"start_time":"11:08:00",
"teacher_name":null
}
],
"timestamp":1533987752.7,
"type":"recurring",
"updated_at":null,
"user_id":4076037,
"year_guid":"2adeab27-b77d-40e8-b5c6-48ff699833ef"
}
],
"exams":[
{
"created_at":"2018-08-11T12:29:16",
"date":"2018-08-28T13:56:00",
"deleted_at":null,
"duration":55,
"guid":"787905c2-1d62-4908-9462-83ce617e9edc",
"module":"",
"resit":false,
"room":"23",
"school_id":null,
"seat":"",
"subject_guid":"bf0bc307-8cff-4f81-9294-68ee99d6fae2",
"timestamp":1533990584.7,
"updated_at":"2018-08-11T12:29:43",
"user_id":4076037
}
],
"subjects":[
{
"color":"1",
"created_at":"2018-08-11T11:30:35",
"deleted_at":null,
"guid":"f5238393-c700-43f0-bde8-fc90637210f3",
"name":"Science",
"school_id":null,
"term_guid":null,
"timestamp":1533987037.8,
"updated_at":null,
"user_id":4076037,
"year_guid":null
}
],
"tasks":[
{
"completed_at":null,
"created_at":"2018-08-11T12:25:05",
"deleted_at":null,
"detail":"A long desccription",
"due_date":"2018-08-14",
"exam_guid":null,
"guid":"11e64a02-9d0b-4105-b393-926462f063e5",
"progress":0,
"school_id":null,
"subject_guid":"66b9eba7-7998-485b-bd2a-5c34398d5311",
"timestamp":1534030060.5,
"title":"A title",
"type":"assignment",
"updated_at":"2018-08-11T23:27:40.487",
"user_id":4076037
}
],
"timetable_settings":null,
"user":{
"country":"AU",
"dob":null,
"email":"email@example.com",
"emails":[
],
"first_name":"John",
"full_name":"John Smith",
"gender":2,
"id":4076037,
"last_name":"Smith",
"linked_accounts":[
{
"provider":"google",
"provider_name":"Google",
"provider_organization_id":"example.org",
"provider_user_id":"000000"
}
],
"no_newsletters":false,
"picture":"http://pictures.com/picture.png",
"provider":"google",
"provider_user_id":"000000",
"school":null,
"settings":{
"dashboard_exams_hidden":false,
"dashboard_exams_hidden_when_none":false,
"dashboard_exams_timescale":7,
"dashboard_tasks_timescale":3,
"default_duration":64,
"default_start_time":"08:40:00",
"first_day_of_week":0,
"is_24_hour":false,
"is_rotation_schedule_lettered":false,
"locale":null
},
"setup_at":"2018-08-11T11:29:46.827",
"timestamp":"1534029418",
"type":"student",
"updated_at":"2018-08-11T23:16:58.01"
}
}
"""
Disclaimer:
I have not contacted My Study Life about the use of their API.
This is provided for educational purposes only.
"""
import requests
API_URL = "https://api.mystudylife.com/v6.1"
token = "your_token"
# Your My Study Life Token. Will look something like XXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXX=
# Found in the local storage (under Chrome Developer Tools - Application in Chrome) as '_'
# accessible via Chrome developer console via `localStorage._`
headers = {"Accept": "application/json", "Authorization": f"Bearer {token}"}
def delete_subject(guid):
requests.delete(f"{API_URL}/subjects/{guid}", headers=headers)
def sync():
response = requests.get(f"{API_URL}/data", headers=headers).json()
print(response["classes"][0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment