簡體   English   中英

Gmail推送通知不會停止

[英]Gmail push notifications does not stop

我正在使用“ WATCH” requset將電子郵件連接到pub / sub API。 但是,當我要停止使用下面的代碼(由Google提供)停止通知時,它不起作用。 我正在使用python客戶端。

credentials = get_credentials()
http = credentials.authorize(httplib2.Http())
service = discovery.build('gmail', 'v1', http=http)
result = service.users().stop(userId='me')

我的參考資料:

https://developers.google.com/gmail/api/guides/push

result = service.users().stop(userId='me').execute()

您忘記了execute方法,直到(除非您調用execute方法)您的語句什么都不做。

這是有關如何使用Google API的小指​​南。 轉到https://developers.google.com/gmail/api/quickstart/python並觀察代碼service.users().labels().list(userId='me').execute()然后轉到Google API資源管理器並選擇您的服務,假設您要使用https://developers.google.com/apis-explorer/#p/gmail/v1/的 Gmail API,您將在此處看到服務和說明,例如

gmail.users.labels.list

gmail是您python代碼中的服務對象,其余是方法,execute對應於此頁面https://developers.google.com/apis-explorer/#p/gmail/v1/gmail.users中的 execute按鈕。 labels.list

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM