【发布时间】:2020-12-08 06:10:33
【问题描述】:
我尝试使用 Google Calendar API
events_result = service.events().list(calendarId=calendarId,
timeMax=now,
alwaysIncludeEmail=True,
maxResults=100, singleEvents=True,
orderBy='startTime').execute()
当我有访问calendarId的权限时一切正常,但是当我没有calendarId权限时如果出错就会出错。
我使用 schedule python 构建了一个 autoload.py 函数,每 10 分钟加载一次事件,如果出现错误,该函数将停止,我必须使用 SSH 终端手动重新启动 autoload.py 所以我想知道:
如何获取status_code,例如如果是404,python会PASS
【问题讨论】:
标签: python google-api http-status-code-404 google-calendar-api google-api-python-client