Reputation: 2597
I am connecting my email to pub/sub API using "WATCH" requset. But when I going to stop notifications using below code(provided by Google) it doesn't work. I am using python client.
credentials = get_credentials()
http = credentials.authorize(httplib2.Http())
service = discovery.build('gmail', 'v1', http=http)
result = service.users().stop(userId='me')
My references:
https://developers.google.com/gmail/api/guides/push
Upvotes: 2
Views: 758
Reputation: 1034
result = service.users().stop(userId='me').execute()
you forgot execute method, until and unless you call execute method, your statements do nothing.
Here's a small guide how to work with google apis. go to https://developers.google.com/gmail/api/quickstart/python and observe the code, service.users().labels().list(userId='me').execute()
then go to Google API Explorer and select your service let's say Gmail API you want to use https://developers.google.com/apis-explorer/#p/gmail/v1/ , there you will see services and description,like this
gmail.users.labels.list
here gmail is service object in your python code, and remaining were the methods, execute corresponds to execute button here in this page https://developers.google.com/apis-explorer/#p/gmail/v1/gmail.users.labels.list
Upvotes: 5