使用谷歌日历v3
日历摘要中有带符号的活动,例如母亲和;父亲
问题是,在使用代码中的Events:list q参数时,找不到这一点。
当使用此API时
google API test page
,其行为如下:
-
寻找母亲&父亲没有任何结果
-
搜索“母亲和父亲”(带引号)将返回预期的事件
当从代码中执行相同的操作时(带引号或不带引号),不会返回事件。
当搜索摘要中没有符号的事件时,代码可以正常工作。
所以问题是:如何从代码中使用q参数来检索名称中带有符号的事件?
编辑2019年12月17日:提供更多细节
设置:带id的谷歌日历,2019年12月19日的活动标题为“母亲和父亲的孩子1”
案例1:寻找“母亲和父亲”,结果(“项目”:查看回复末尾)为空:
_api_list_args['q'] = 'mother&father'
GoogleConfig.service.events().list(**_api_list_args).execute()
GET https://www.googleapis.com/calendar/v3/calendars/<my_cal_id>%40group.calendar.google.com/events?singleEvents=true&q=father&orderBy=startTime&maxResults=8&timeMin=2019-12-17T14%3A47%3A17.205463Z&timeMax=2020-06-16T00%3A00%3A00.000Z&alt=json
{'kind': 'calendar#events',
'etag': '"p334fb5lauquec0g"',
'summary': 'SWD local',
'updated': '2019-12-17T14:46:39.117Z',
'timeZone': 'Europe/Brussels',
'accessRole': 'writer',
'defaultReminders': [],
'items': []}
案例2:寻找“父亲”,结果也是空的:
_api_list_args['q'] = 'father'
GoogleConfig.service.events().list(**_api_list_args).execute()
URL being requested: GET https://www.googleapis.com/calendar/v3/calendars/<my_cal_id>%40group.calendar.google.com/events?singleEvents=true&q=father&orderBy=startTime&maxResults=8&timeMin=2019-12-17T14%3A47%3A17.205463Z&timeMax=2020-06-16T00%3A00%3A00.000Z&alt=json
{'kind': 'calendar#events',
'etag': '"p328ajglquuuec0g"',
'summary': 'SWD local',
'updated': '2019-12-17T14:51:41.818Z',
'timeZone': 'Europe/Brussels',
'accessRole': 'writer',
'defaultReminders': [],
'items': []}
案例3:寻找“child1”,现在它找到了事件:
_api_list_args['q'] = 'child1'
GoogleConfig.service.events().list(**_api_list_args).execute()
URL being requested: GET https://www.googleapis.com/calendar/v3/calendars/<my_cal_id>%40group.calendar.google.com/events?singleEvents=true&q=child1&orderBy=startTime&maxResults=8&timeMin=2019-12-17T14%3A47%3A17.205463Z&timeMax=2020-06-16T00%3A00%3A00.000Z&alt=json
{'kind': 'calendar#events',
'etag': '"p338fbacsvauec0g"',
'summary': 'SWD local',
'updated': '2019-12-17T15:04:03.810Z',
'timeZone': 'Europe/Brussels',
'accessRole': 'writer',
'defaultReminders': [],
'items': [{'kind': 'calendar#event',
'etag': '"3153190087620000"',
'id': 'p939brcc2r83cu9q52sjagcua4_20191219T200000Z',
'status': 'confirmed',
'htmlLink': 'https://www.google.com/calendar/event?eid=cDkzOWJyY2MycjgzY3U5cTUyc2phZ2N1YTRfMjAxOTEyMTlUMjAwMDAwWiBnNXJ1cTl1Z2xlNWc2ZTFhMms1cmZyM2hjY0Bn',
'created': '2019-11-29T16:58:45.000Z',
'updated': '2019-12-17T15:04:03.810Z',
'summary': 'mother&father child1',
'description': 'my nice description<br><a href="<mysite>" id="ow2358" __is_owner="true"><mysite></a>',
'location': '#MYLOCATION',
'creator': {'email': '<myemail>'},
'organizer': {'email': '<my_cal_id>@group.calendar.google.com',
'displayName': 'SWD local',
'self': True},
'start': {'dateTime': '2019-12-19T21:00:00+01:00', 'timeZone': 'Europe/Brussels'},
'end': {'dateTime': '2019-12-19T22:00:00+01:00', 'timeZone': 'Europe/Brussels'},
'recurringEventId': 'p939brcc2r83cu9q52sjagcua4',
'originalStartTime': {'dateTime': '2019-12-19T21:00:00+01:00', 'timeZone': 'Europe/Brussels'},
'iCalUID': 'p939brcc2r83cu9q52sjagcua4@google.com',
'sequence': 0,
'extendedProperties': {'shared': {'course_162': '1'}},
'reminders': {'useDefault': True}}]}
但是:这一个也失败了:寻找“chil”即单词的一部分。。。
案例4:寻找“孩子”
_api_list_args['q'] = 'chil'
GoogleConfig.service.events().list(**_api_list_args).execute()
URL being requested: GET https://www.googleapis.com/calendar/v3/calendars/<my_cal_id>%40group.calendar.google.com/events?singleEvents=true&q=chil&orderBy=startTime&maxResults=8&timeMin=2019-12-17T14%3A47%3A17.205463Z&timeMax=2020-06-16T00%3A00%3A00.000Z&alt=json
{'kind': 'calendar#events',
'etag': '"p338fbacsvauec0g"',
'summary': 'SWD local',
'updated': '2019-12-17T15:04:03.810Z',
'timeZone': 'Europe/Brussels',
'accessRole': 'writer',
'defaultReminders': [],
'items': []}
谷歌的“q”参数只搜索整个单词吗??