akarri2001 / notion-and-google-calendar-2-way-sync Goto Github PK
View Code? Open in Web Editor NEW2 Way Sync Between Notion Database and Google Calendar
License: GNU General Public License v3.0
2 Way Sync Between Notion Database and Google Calendar
License: GNU General Public License v3.0
Hey @akarri2001. This is an amazing project but I'm unable to run it because of so many errors. I followed the docs and changed the token etc. Kindly fix this error. If possible can you make YouTube Tutorial on How to configure this project step by step because from docs I got stuck in between. Thank you
Traceback (most recent call last):
File "E:\Python Work\Notion & Google calender\Notion-and-Google-Calendar-2-Way-Sync\Notion-GCal-2WaySync-Public.py", line 738, in
TaskNames.append(el['properties'][Task_Notion_Name]['title'][0]['text']['content'])
KeyError: 'title'
HttpError 404 when requesting (https://www.googleapis.com/calendar/v3/calendars)
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\googleapiclient\http.py", line 935, in execute raise HttpError(resp, content, uri=self.uri) googleapiclient.errors.HttpError: <HttpError 404 when requesting https://www.googleapis.com/calendar/v3/calendars/6cw0v*************group.calendar.google.com/events/7b52796dfobjgijp9vlv8cf80s/move?destination=fd34893uklhjdflgkjsdafdfjklsd%40group.calendar.google.com&alt=json returned "Not Found". Details: "[{'domain': 'global', 'reason': 'notFound', 'message': 'Not Found'}]">
and
During handling of the above exception, another exception occurred:
ValueError("unconverted data remains: %s":
File "C:\Users\User\***\Notion-and-Google-Calendar-2-Way-Sync-main/Notion-GCal-2WaySync-Public.py", line 762, in <module> calEventId = upDateCalEvent(TaskNames[i], makeEventDescription(Initiatives[i], ExtraInfo[i]), datetime.strptime(start_Dates[i], '%Y-%m-%d'), URL_list[i], updatingCalEventIds[i], datetime.strptime(end_Times[i], '%Y-%m-%d'), CurrentCalList[i], CalendarList[i]) File "C:\Users\User\AppData\Local\Programs\Python\Python3.9/_strptime.py", line 568, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) File "C:\Users\User\AppData\Local\Programs\Python\Python3.9/_strptime.py", line 352, in _strptime raise ValueError("unconverted data remains: %s" % ValueError: unconverted data remains: [T00:00:00.000+02:00](url)
after pasting the link created with the gcaltoken.py google gives me this message
"Access blocked: NOTION GCAL SYNC has not completed the Google verification process
NOTION GCAL SYNC has not completed the Google verification process. The app is currently being tested, and can only be accessed by developer-approved testers. If you think you should have access, contact the developer.
If you are a developer of NOTION GCAL SYNC, see error details.
Error 403: access_denied"
i cheked every step, and did exactly as the instruccion said
I did exactly what the tutorial says but when I run "python3 Notion-GCal-2WaySync-Public.py" it says the following.
What should I do now?
File "/home/lelouvincx/.local/lib/python3.9/site-packages/notion_client/client.py", line 83, in _parse_response
response.raise_for_status()
File "/home/lelouvincx/.local/lib/python3.9/site-packages/httpx/_models.py", line 1105, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: 404 Client Error: Not Found for url: https://api.notion.com/v1/databases/3b58b006436c477e85c500fb2a41152f/query
For more information check: https://httpstatuses.com/404
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/lelouvincx/Documents/NotionXGCalendar/Notion-GCal-2WaySync-Public.py", line 394, in <module>
my_page = notion.databases.query( #this query will return a dictionary that we will parse for information that we want
File "/home/lelouvincx/.local/lib/python3.9/site-packages/notion_client/api_endpoints.py", line 46, in query
return self.parent.request(
File "/home/lelouvincx/.local/lib/python3.9/site-packages/notion_client/client.py", line 133, in request
return self._parse_response(response)
File "/home/lelouvincx/.local/lib/python3.9/site-packages/notion_client/client.py", line 93, in _parse_response
raise APIResponseError(error.response, body)
notion_client.errors.APIResponseError: Could not find database with ID: 3b58b006-436c-477e-85c5-00fb2a41152f.```
When I run the code.
It shows the following
ModuleNotFoundError: No module named 'notion_client'
I have installed notion and also no other file named notion.py, so I don't know how to solve that.
The second error is that "GCalTokenLocation is not defined"
I have put my notion token string in the NOTION_TOKEN(line 15)
The events in gCal are not being deleted although DELETE_OPTION is set to 0, the task in Notion has a name and both "Done?" and "On GCal?" are checked off
Hey! Thank you so much for this project! This is exactly what I have been looking for.
I however encouter a problem with the endtimes of events in Notion. If I've read it correctly in the added features you have mentioned that endtimes should be synced both ways. This works when I create an event in GCal; it shows up correctly. But if I enter an endtime in Notion it ends up with the default 60 minutes duration in GCal.
Do I have to adjust something in the code to make this work? I have read the code from top to bottom but can't seem to find the place where this should be adjusted.
Notion feeds GCal perfectly, but when I run Part 4: Bring events (not in Notion already) from GCal to Notion it gives me this error:
File "Notion-GCal-2WaySync-Public.py", line 1253, in
calName = [item['summary'] for item in calItems]
File "Notion-GCal-2WaySync-Public.py", line 1253, in
calName = [item['summary'] for item in calItems]
KeyError: 'summary'
I'm kinda a python newbie, so I'd be grateful for any help ;)
I just set up your script and can't figure out what's wrong from this error. May you help?
❯ python3 ./Notion-GCal-2WaySync-Public.py
Nothing new added to GCal
Nothing new updated to GCal
Traceback (most recent call last):
File "/home/blue/Downloads/Notion-and-Google-Calendar-2-Way-Sync/./Notion-GCal-2WaySync-Public.py", line 841, in <module>
notion_gCal_IDs.append(result['properties'][GCalEventId_Notion_Name]['rich_text'][0]['text'])
IndexError: list index out of range
Hi! For some reason, the credentialsLocation is giving me a FileNotFoundError for my token.pkl. I switched the slashes and even did a quick print on os.path.isfile("token.pkl") and it returned True. Any tips? Thanks!
Hello, good work man!
Where i can get credentialsLocation ?
Can you help me little from anydesk or skype?
Hello,
Thank you for your work!
I noticed that when I accept events' invitations in google calendar, the code exits with an error saying that the email of the event organiser is not "on list" and exiting the execution of the script, without synching any further events. It also refers to line 1259. It seems like a default calendar should be set to sync such events into.
Would be very thankful for your help!
Hi,
I am unable to find my calendar id. It appears as for the "main" calendar, the calendar id is just the email address, ie "[email protected]"
Thus I'm unable to plug the id in the code.
Someone was able to integrate the script with their "main" calendar?
Any help?
Thanks
el["properties"][Initiative_Notion_Name]["select"]["name"] # TODO: Make this work with Project relation
Hi,
Thank you very much for your work! Once i get it working, it will make a huge difference in my personal organization. When I hit enter after typing "python3 GCalToken.py" (step 19b, iOS), nothing happens so I can't get the URL necessary to move forward.
Anyone know what I might be doing wrong? I saw a few reddit comments describing a similar issue.
Thanks!
Traceback (most recent call last):
File "C:\Users\User\Downloads\Notion-and-Google-Calendar-2-Way-Sync\Notion-GCal-2WaySync-Public.py", line 728, in
CurrentCalList.append(el['properties'][Current_Calendar_Id_Notion_Name]['rich_text'][0]['text']['content'])
IndexError: list index out of range
I always get this error when running the python, but the code works except for syncing my second calendar. Both calendars are mine.
P.S.
I don't think it's a bug but I needed help so posted this here.
THE ISSUE:
In short, my python script won't allow any update in an already existing event through Notion. The "Part 2" of the script doesn't work.
DETAILS OF THE ISSUE:
Whenever I try to update an event on Notion the "result_list" variable (just after the attribution of the variable "my_page") it returns an empty list, so it isn't running both "if" blocks from the part 2:
if len(resultList) > 0:
for i, el in enumerate(resultList):
pageId = el['id']
my_page = notion.pages.update( ##### This checks off that the event has been put on Google Calendar
**{
"page_id": pageId,
"properties": {
Calendar_Notion_Name: {
'select': {
"name": DEFAULT_CALENDAR_NAME
},
},
LastUpdatedTime_Notion_Name: {
"date":{
'start': notion_time(),
'end': None,
}
},
},
},
)
WHAT HAS BEEN OBSERVED:
Thanks again for the great code.
Now, when I was running this code, it sometimes generated duplicate tasks in the database.
Apparently, there is a problem with the procedure in Part 4 that looks for calendar events that don't exist in Notion.
my_page = notion.databases.query( **{ "database_id": database_id, "filter": { "property": GCalEventId_Notion_Name, "text": { "is_not_empty": True } } }, )
In the Notion API, query responses are limited to 100 at a time.
If there are more than 101 tasks, the IDs contained in the 101st task will not be used for comparison.
Therefore, the program will overlook the IDs that should already be there, so it will add a new column of Notion.
I can't think of a solution right away, so I'll post it in an issue.
Hi,
My code successfully pushes events from Notion to gcal but not the other way around. The code receives a bad request at line 1247 i.e., x = service.events().list(calendarId = calendarDictionary[el], maxResults = 2000, timeMin = googleQuery() ).execute()
I have checked that the calendar id is correct. Please could anyone help?
Thanks
` File "C:\Users\User\Desktop\Coding_Projects\NotionXGCal\Notion-GCal-2WaySync-Public.py", line 759, in
calEventId = upDateCalEvent(TaskNames[i], makeEventDescription(Initiatives[i], ExtraInfo[i]), datetime.strptime(start_Dates[i], '%Y-%m-%d'), URL_list[i], updatingCalEventIds[i], datetime.strptime(end_Times[i], '%Y-%m-%d'), CurrentCalList[i], CalendarList[i])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\Desktop\Coding_Projects\NotionXGCal\Notion-GCal-2WaySync-Public.py", line 374, in upDateCalEvent x= service.events().move(calendarId= currentCalId , eventId= eventId, destination=CalId).execute()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\googleapiclient_helpers.py", line 134, in positional_wrapper
return wrapped(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\googleapiclient\http.py", line 935, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 404 when requesting https://www.googleapis.com/calendar/v3/calendars/3cq0v2l8n197dmrie8l7vhjlj0%40group.calendar.google.com/events/7b52796dfobjgijp9vlv8cf80s/move?destination=fd34893uklhjdflgkjsdafdfjklsd%40group.calendar.google.com&alt=json returned "Not Found". Details: "[{'domain': 'global', 'reason': 'notFound', 'message': 'Not Found'}]">
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\User\Desktop\Coding_Projects\NotionXGCal\Notion-GCal-2WaySync-Public.py", line 762, in
calEventId = upDateCalEvent(TaskNames[i], makeEventDescription(Initiatives[i], ExtraInfo[i]), datetime.strptime(start_Dates[i][:-6], "%Y-%m-%dT%H:%M:%S.000"), URL_list[i], updatingCalEventIds[i], datetime.strptime(end_Times[i][:-6], "%Y-%m-%dT%H:%M:%S.000"), CurrentCalList[i], CalendarList[i])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib_strptime.py", line 349, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data '2023' does not match format '%Y-%m-%dT%H:%M:%S.000'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\User\Desktop\Coding_Projects\NotionXGCal\Notion-GCal-2WaySync-Public.py", line 764, in
calEventId = upDateCalEvent(TaskNames[i], makeEventDescription(Initiatives[i], ExtraInfo[i]), datetime.strptime(start_Dates[i][:-6], "%Y-%m-%dT%H:%M:%S.%f"), URL_list[i], updatingCalEventIds[i], datetime.strptime(end_Times[i][:-6], "%Y-%m-%dT%H:%M:%S.%f"), CurrentCalList[i], CalendarList[i])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib_strptime.py", line 349, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data '2023' does not match format '%Y-%m-%dT%H:%M:%S.%f'
Hi, thanks for your amazing script. It did help a lot.
But there's a little inconvenient when navigating to notion page, I was wondering is any possible adding notion direct link url
like "https://www.notion.so/XXXXXX" in description column for direct link, Thx.
If you delete the GCal event and not the Notion item, the calendar sync is inaccurate for other events. However, if you delete the Notion item and run the code again, then everything is fixed again.
I receive following errors:
1)File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/_strptime.py", line 352, in _strptime
raise ValueError("unconverted data remains: %s" %
ValueError: unconverted data remains: T13:00:00.000-04:00
Can anybody help?
File "C:\CalendarSync\GCalToken.py", line 1, in
from googleapiclient.discovery import build
ModuleNotFoundError: No module named 'googleapiclient'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.