Watch request in gmail API doesn't work

这一生的挚爱 提交于 2019-12-19 19:49:30

问题


I am trying to make a watch request using python as referred to in the google APIs but it does not work.

request = {
  'labelIds': ['INBOX'],
  'topicName': 'projects/myproject/topics/mytopic'
}
gmail.users().watch(userId='me', body=request).execute()

I could not find a library or a package to use gmail.users() function. How do I make a watch request using an access token?


回答1:


Do it in gmail python client(provide by google).under main function

request = {
        'labelIds': ['INBOX'],
        'topicName': 'projects/myprojects/topics/getTopic'
    }
    print(service.users().watch(userId='me', body=request).execute())



回答2:


const { google } = require('googleapis') 
const gmail = google.gmail({ version: 'v1' }) 

gmail is just an object from the client library. In the above is the node js library. Look in the python client library for answers.

This is what I do not like about a lot of the google docs on their api, they assume you know what is loaded or have seen an example in some obscure place.



来源:https://stackoverflow.com/questions/40057253/watch-request-in-gmail-api-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!