Commit ef56fe31 authored by jyong's avatar jyong

update notion page title

parent 8a05f53c
......@@ -125,7 +125,18 @@ class NotionOAuth(OAuthDataSource):
results = response_json['results']
for result in results:
page_id = result['id']
page_name = result['properties']['Name']['title'][0]['plain_text']
if 'Name' in result['properties']:
if len(result['properties']['Name']['title']) > 0:
page_name = result['properties']['Name']['title'][0]['plain_text']
else:
page_name = 'Untitled'
elif 'title' in result['properties']:
if len(result['properties']['title']['title']) > 0:
page_name = result['properties']['title']['title'][0]['plain_text']
else:
page_name = 'Untitled'
else:
page_name = 'Untitled'
page_icon = result['icon']
page = {
'page_id': page_id,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment