diff --git a/README.md b/README.md index 9d96a53..ca2baa2 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,7 @@ [![Build Status](https://travis-ci.org/b4tman/sync_ics2gcal.svg?branch=master)](https://travis-ci.org/b4tman/sync_ics2gcal) Python scripts for sync .ics file with Google calendar + +## How it works + +![How it works](how-it-works.png) diff --git a/gcal_sync/gcal.py b/gcal_sync/gcal.py index fe418e9..4d02e14 100644 --- a/gcal_sync/gcal.py +++ b/gcal_sync/gcal.py @@ -1,10 +1,11 @@ -from apiclient import discovery -import httplib2 import logging -from oauth2client import service_account -from pytz import utc import sys +import google.auth +from google.oauth2 import service_account +from googleapiclient import discovery +from pytz import utc + class GoogleCalendarService(): """class for make google calendar service Resource @@ -21,14 +22,12 @@ class GoogleCalendarService(): service Resource """ - scopes = 'https://www.googleapis.com/auth/calendar' - credentials = service_account.ServiceAccountCredentials.from_json_keyfile_name( - service_account_file, scopes=scopes) - http = credentials.authorize(httplib2.Http()) - service = discovery.build('calendar', 'v3', http=http) + scopes = ['https://www.googleapis.com/auth/calendar'] + credentials = service_account.Credentials.from_service_account_file(service_account_file) + scoped_credentials = credentials.with_scopes(scopes) + service = discovery.build('calendar', 'v3', credentials=scoped_credentials) return service - def select_event_key(event): """select event key for logging diff --git a/how-it-works.png b/how-it-works.png new file mode 100644 index 0000000..876d32f Binary files /dev/null and b/how-it-works.png differ diff --git a/requirements.txt b/requirements.txt index 99cd8ea..ed90f3a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ -google-api-python-client==1.6.6 -icalendar==4.0.1 -pytz==2018.3 -PyYAML==3.12 +google-auth==1.5.0 +google-api-python-client==1.7.3 +icalendar==4.0.2 +pytz==2018.5 +PyYAML==3.13