Skip to main content

An easy interface for Google Calendar

Project description

An easy interface for Google Calendar

Install

pip install google_calendar_interface

This project is a work in progress. Please excuse any unprofessionalism

Example Usage

from gs_oauth_tools import AuthManager
import datetime
import time
import webbrowser

MY_ID = '4105'

authManager = AuthManager(googleJSONpath=r'C:\Users\gmiller\PycharmProjects\gs_oauth\google_test_creds.json')
user = authManager.GetUserByID(MY_ID)

if not user:
    d = authManager.CreateNewUser(MY_ID, 'Google')
    webbrowser.open(d.get('verification_uri'))
    print('d=', d)

    while not user:
        user = authManager.GetUserByID(MY_ID)
        time.sleep(1)

    print('user=', user)

google = GoogleCalendar(
    calendarName='Grants Test New Calendar',
    getAccessTokenCallback=user.GetAccessToken,
    debug=True,
)

google.NewCalendarItem = lambda _, event: print('NewCalendarItem', event)
google.CalendarItemChanged = lambda _, event: print('CalendarItemChanged', event)
google.CalendarItemDeleted = lambda _, event: print('CalendarItemDeleted', event)

google.UpdateCalendar()

if len(google.GetNowCalItems()) == 0:
    google.CreateCalendarEvent(
        subject=time.asctime(),
        body='body',
        startDT=datetime.datetime.now(),
        endDT=datetime.datetime.now() + datetime.timedelta(minutes=5),
    )

while True:
    google.UpdateCalendar()
    time.sleep(10)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

google_calendar_interface-0.0.2.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file google_calendar_interface-0.0.2.tar.gz.

File metadata

  • Download URL: google_calendar_interface-0.0.2.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.2

File hashes

Hashes for google_calendar_interface-0.0.2.tar.gz
Algorithm Hash digest
SHA256 ae52bb82778129654a2001d08b1805e0155e7b07e346092c0517f3ad110e047d
MD5 0fea8a6a0b2f43175db756ce65cc4544
BLAKE2b-256 2ec525cdf0e06f4b36136655565ffda05b765244916f06de1cb3cb2ee11f75d3

See more details on using hashes here.

File details

Details for the file google_calendar_interface-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: google_calendar_interface-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.2

File hashes

Hashes for google_calendar_interface-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 20d47248a524cba9e43d921aea4b0d2e31eca902c3b12396feacc54048f2fedb
MD5 bc6458b15ae324a2bd38fa94792af07a
BLAKE2b-256 bbc6c99475c177b5aa69f286caabcceac9bfea349eea43cb04b0d851d959a506

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page