Self hosting - Odissus/MyTutorCalendar GitHub Wiki

Self hosting

Pre-requisites

The pre-requisites include:

The Python Libraries you'll need:

  • numpy built-in
  • icalendar pip install icalendar
  • datetime built-in
  • requests pip install requests
  • bs4 pip install beautifulsoup4
  • re built in
  • calendar built-in
  • boxsdk with JWTAuth pip install boxsdk[jwt]
  • os built-in
  • lxml pip install lxml

Deployment

Download all files and log into your box account. You'll have to open the Developer Tab and create a new project. Then you'll need to give it full access and generate the private/public keys so the script can log in. Pick the JSON file option and download it on your machine, this is the json_file variable at the bottom of the script (you can rename the file or change it in the script).

From here we just need one more thing. Open MyTutor Website, log in, and open any tab you like. Under Inspect element, select network and refresh the page. The first item (like marketplace.html) will have a tab name Cookies. Retrieve the value of a request cookie called www.mytutor.co.uk, it should look like TUTOR-12345678-.... Save this in notepad in this format: Cookie: TUTOR-5fa62eab-0f3a-487f-9f7a-5ec4386190b9 and name the file Cookie.conf.

Note: The files are assumed to be in the same directory as the script. If that is not the case, you'll have to modify the paths at the bottom of the script to load the configs correctly.

From here on, the script should run fine, and you'll need to retrieve the link to the icalendar file to put it in your calendar of choice. You'll need to output res, the last variable of the script. It will be your box's account share link to the .ics file.

Recurrence

You'll have to set up a system of your own that will run this script (I'd suggest every half an hour, as that's the refreshment period on the calendar file). There are a few ways to go about it:

  • Use your computer's built-in task scheduling system (Windows, macOS, Linux)
  • Use a virtual machine such as Google or Oracle (There are others of course)