clschalkwyk / eskom-se-push-calendar

Scripts to pull loadshedding schedule and publish to your calendar.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This tool/scripts are used to pull EskomSePush data and push events to your selected calendar.

Prerequisites

EskomSePush API Key

Google Calendar API

  • Visit Google Developer Console to create a new project.
  • https://console.cloud.google.com/getting-started?pli=1
  • Search for the Google Calendar API and enable it for your project.
  • Create Credentials:
    • In the API & Services dashboard, go to the Credentials page.
    • Click on "Create Credentials" and select "OAuth client ID".
    • If prompted, configure the consent screen.
    • For application type, select "Desktop app" and give it a name.
    • Download the JSON file for your credentials.

For Personal or Internal Use

Go to the Google Cloud Console.

  • Select your project → Go to "OAuth consent screen".
  • In the "Test users" section, add the Google accounts (email addresses) that need to use this application, including [your email address]. This will allow these accounts to authorize the application without completing the verification process.

Preparing for Verification

If you intend to make your application available to users outside of your test user list, you'll need to submit it for verification by Google:

  • Ensure that your application complies with Google's API Services User Data Policy and the Additional Requirements for Specific API Scopes.
  • Complete all the required fields in the "OAuth consent screen" setup in the Google Cloud Console. This includes application name, user support email, developer contact information, and a detailed justification for each requested scope.
  • Submit your application for verification by clicking the “Submit for verification” button at the bottom of the OAuth consent screen page.

During Development

Add Test Users:

  • For development and testing purposes, continue to add any necessary test users to allow them to use the application without undergoing the full verification process.

Reduce Scopes:

  • If possible, use the least sensitive scopes necessary for your application to function. Applications requesting fewer and less sensitive scopes are subject to a simpler verification process.

Install Required Libraries

pip install -f requirements.txt

Configure .env file

  • add EskomSePush API Key as LICENSE_KEY
  • add Google credentials to "credentials.json"

Determine your location ID on EskomSePush

Run the location lookup script

python location_search.py
  • This script will ask for a location to search for. Type in your nearest address and hit enter.
  • From the table of locations, find the one closest to you, then copy the "Id"
  • Save Id in .env as ESKOM_LOCATION

Lookup Calendar Id

Next we need to find the correct calendar to send the schedule to. I would suggest creating a new calendar first, to keep things clean.

Run the list_calendars script

python list_calendars.py

From the table listed, copy the Id of your calendar you want to use and save it in the .env file as CALENDAR_ID

Once we have all the IDs in place, run main.py

python main.py

About

Scripts to pull loadshedding schedule and publish to your calendar.


Languages

Language:Python 100.0%