Further changes from live site

This commit is contained in:
Martin Bauer 2018-12-18 12:57:21 +01:00
parent 530d6bf060
commit 72a9642a8e
10 changed files with 15 additions and 7 deletions

View File

@ -1 +1 @@
{"_module": "oauth2client.client", "token_expiry": "2014-06-20T09:36:07Z", "access_token": "ya29.LgA4Q4jhQqjEoBwAAABv_luKCAgrb2C-s1IcYmGZ8nZViS_QHvHKT-IkSo31RQ", "token_uri": "https://accounts.google.com/o/oauth2/token", "invalid": false, "token_response": {"access_token": "ya29.LgA4Q4jhQqjEoBwAAABv_luKCAgrb2C-s1IcYmGZ8nZViS_QHvHKT-IkSo31RQ", "token_type": "Bearer", "expires_in": 3600}, "client_id": "34462582242-4kpdvvbi27ajt4u22uitqurpve9o8ipj.apps.googleusercontent.com", "id_token": null, "client_secret": "y4t9XBrJdCODPTO5UvtONWWn", "revoke_uri": "https://accounts.google.com/o/oauth2/revoke", "_class": "OAuth2Credentials", "refresh_token": "1/7-6-m_lLAKX8IeD7OuGtkcIiprty_nZUSxhMunSC5b0", "user_agent": null} {"_module": "oauth2client.client", "token_expiry": "2018-12-18T12:55:20Z", "access_token": "ya29.Gl12BuJlFBtRZSBtMkxubhfG8rYDsLUgc1yKMpO9_aE3tmi4sLFGLq_Djq5R9zr1919oZAobX0oaD6bTj3s4i9kqWfw0gpOGKJKRHM1Y9gHc0JsCe2kChNszu_RCAaE", "token_uri": "https://accounts.google.com/o/oauth2/token", "invalid": false, "token_response": {"access_token": "ya29.Gl12BuJlFBtRZSBtMkxubhfG8rYDsLUgc1yKMpO9_aE3tmi4sLFGLq_Djq5R9zr1919oZAobX0oaD6bTj3s4i9kqWfw0gpOGKJKRHM1Y9gHc0JsCe2kChNszu_RCAaE", "scope": "https://www.googleapis.com/auth/calendar", "expires_in": 3600, "token_type": "Bearer"}, "client_id": "34462582242-4kpdvvbi27ajt4u22uitqurpve9o8ipj.apps.googleusercontent.com", "id_token": null, "client_secret": "y4t9XBrJdCODPTO5UvtONWWn", "revoke_uri": "https://accounts.google.com/o/oauth2/revoke", "_class": "OAuth2Credentials", "refresh_token": "1/txixroRJyyVmuENPpaXyB_bGeXa1XV-pClAxqKHk_5-JW1qGFE0Gl-WlgCu1Eizq", "user_agent": null}

BIN
blechreiz/database.sqlite Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

View File

@ -183,8 +183,7 @@ GCAL_COUPLING = {
'clientId' : '34462582242-4kpdvvbi27ajt4u22uitqurpve9o8ipj.apps.googleusercontent.com', 'clientId' : '34462582242-4kpdvvbi27ajt4u22uitqurpve9o8ipj.apps.googleusercontent.com',
'client_secret' : 'y4t9XBrJdCODPTO5UvtONWWn', 'client_secret' : 'y4t9XBrJdCODPTO5UvtONWWn',
'credentials_file' : PROJECT_PATH + '/calendarCredentials.dat', 'credentials_file' : PROJECT_PATH + '/calendarCredentials.dat',
'push_url' : "https://test.bauer.technology/eventplanner_gcal/gcalApiCallback", 'push_url' : "https://blechreiz.bauer.technology/eventplanner_gcal/gcalApiCallback",
#'push_url' : "https://test.bauer.technology/callbackTest2.php",
} }

View File

@ -19,13 +19,18 @@ def createGCalServiceObject():
"""Creates a Google API service object. This object is required whenever a Google API call is made""" """Creates a Google API service object. This object is required whenever a Google API call is made"""
from oauth2client.file import Storage from oauth2client.file import Storage
from apiclient.discovery import build from apiclient.discovery import build
from oauth2client import tools, client
gcal_settings = settings.GCAL_COUPLING gcal_settings = settings.GCAL_COUPLING
storage = Storage( gcal_settings['credentials_file'] ) storage = Storage( gcal_settings['credentials_file'] )
credentials = storage.get() credentials = storage.get()
print("credentials", credentials)
if credentials is None or credentials.invalid == True: if credentials is None or credentials.invalid == True:
#flow = client.flow_from_clientsecrets(CLIENT_SEICRET_FILE, SCOPES)
print("invalid credentials for gcal")
logger.error("Unable to initialize Google Calendar coupling. Check your settings!") logger.error("Unable to initialize Google Calendar coupling. Check your settings!")
return None return None
@ -34,6 +39,7 @@ def createGCalServiceObject():
res = build( serviceName='calendar', version='v3', res = build( serviceName='calendar', version='v3',
http=http, developerKey=gcal_settings['developerKey'] ) http=http, developerKey=gcal_settings['developerKey'] )
print("res", res)
if res is None: if res is None:
logger.error( "Authentication at google API failed. Check your settings!" ) logger.error( "Authentication at google API failed. Check your settings!" )
return res return res
@ -216,8 +222,9 @@ def syncFromLocalToGoogle( service = None ):
""" Creates a google event for each local event (if it does not exist yet) and deletes all google events """ Creates a google event for each local event (if it does not exist yet) and deletes all google events
that are not found in local database. Updates participation info of gcal events using local data that are not found in local database. Updates participation info of gcal events using local data
""" """
if service is None: service = getServiceObject() if service is None: service = getServiceObject()
allEvents = getAllGCalEvents( service ) allEvents = getAllGCalEvents( service )
eventsAtGoogle_djangoID = set() eventsAtGoogle_djangoID = set()
@ -271,7 +278,7 @@ def syncFromLocalToGoogle( service = None ):
def syncFromGoogleToLocal( service = None ): def syncFromGoogleToLocal( service = None ):
"""Retrieves only participation infos for all events and updates local database if anything has changed. """ """Retrieves only participation infos for all events and updates local database if anything has changed. """
if service is None: service = getServiceObject() if service is None: service = getServiceObject()
newStatusReceived = False newStatusReceived = False

View File

@ -1 +1 @@
{"_module": "oauth2client.client", "token_expiry": "2014-03-08T14:33:53Z", "access_token": "ya29.1.AADtN_UH8eRhIXsdwF4W1D5oC8xYlMhG-0qeT210pyb6pxk7LTLmd-EnUNVS2UjJZQ", "token_uri": "https://accounts.google.com/o/oauth2/token", "invalid": false, "token_response": {"access_token": "ya29.1.AADtN_UH8eRhIXsdwF4W1D5oC8xYlMhG-0qeT210pyb6pxk7LTLmd-EnUNVS2UjJZQ", "token_type": "Bearer", "expires_in": 3600}, "client_id": "34462582242-4kpdvvbi27ajt4u22uitqurpve9o8ipj.apps.googleusercontent.com", "id_token": null, "client_secret": "y4t9XBrJdCODPTO5UvtONWWn", "revoke_uri": "https://accounts.google.com/o/oauth2/revoke", "_class": "OAuth2Credentials", "refresh_token": "1/7-6-m_lLAKX8IeD7OuGtkcIiprty_nZUSxhMunSC5b0", "user_agent": null} {"_module": "oauth2client.client", "token_expiry": "2017-10-24T07:29:15Z", "access_token": "ya29.GlvuBAjiaOmu9fZaR9RElCkEvkcJVv-lL-hsL8bGczd-Lvl-y_vYA-dHPmCurc111i7SwLCY2nWRrUcZneR3bwGQuOW8j6MbeYncJDRcpjqYJBGpJUxuTizafOOv", "token_uri": "https://accounts.google.com/o/oauth2/token", "invalid": false, "token_response": {"access_token": "ya29.GlvuBAjiaOmu9fZaR9RElCkEvkcJVv-lL-hsL8bGczd-Lvl-y_vYA-dHPmCurc111i7SwLCY2nWRrUcZneR3bwGQuOW8j6MbeYncJDRcpjqYJBGpJUxuTizafOOv", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "1/txixroRJyyVmuENPpaXyB_bGeXa1XV-pClAxqKHk_5-JW1qGFE0Gl-WlgCu1Eizq"}, "client_id": "34462582242-4kpdvvbi27ajt4u22uitqurpve9o8ipj.apps.googleusercontent.com", "id_token": null, "client_secret": "y4t9XBrJdCODPTO5UvtONWWn", "revoke_uri": "https://accounts.google.com/o/oauth2/revoke", "_class": "OAuth2Credentials", "refresh_token": "1/txixroRJyyVmuENPpaXyB_bGeXa1XV-pClAxqKHk_5-JW1qGFE0Gl-WlgCu1Eizq", "user_agent": null}

View File

@ -16,7 +16,9 @@ if createLink:
print "Visit this link - grab the key from the url and paste it into the else block" print "Visit this link - grab the key from the url and paste it into the else block"
exit(0) exit(0)
else: else:
code = "4/Iais8aK8_KxbMQjq3Rtw3PFXu6Nr.8itpukY_6ZgZOl05ti8ZT3ax27a3hAI" #code = "4/Iais8aK8_KxbMQjq3Rtw3PFXu6Nr.8itpukY_6ZgZOl05ti8ZT3ax27a3hAI"
#code = "4/YjdxGI8sIokRhYVE18ut9WMeYbmRLfazB-HOGCyqo4M#"
code = "4/3EhMJx4WlXrZhyEwGGiHG-rhJzZAPrALFEYJpfvp5J8#"
credentials = flow.step2_exchange( code ) credentials = flow.step2_exchange( code )
storage = Storage('calendarCredentials.dat') storage = Storage('calendarCredentials.dat')
storage.put( credentials ) storage.put( credentials )