Python Adding contact on Google Contacts

夙愿已清 提交于 2020-01-05 04:29:11

问题


Do someone know how to add a new contact to my google account via python?

I didn't find how to do it in the reference: https://developers.google.com/google-apps/contacts/v3/reference

I want to add contact and I have only phone number and name.

Does someone know how to do it?


回答1:


I am writing down the steps and also adding some reference link, such that you will have better understanding

  • You can use Google Oauth2 to get access to the Google Contact and need to enable Contact API and People API

  • Google Contact API

    • Ref to Enable API: https://www.themarketingtechnologist.co/google-oauth-2-enable-your-application-to-access-data-from-a-google-user/
    • Ref to Enable API: https://medium.com/@pablo127/google-api-authentication-with-oauth-2-on-the-example-of-gmail-a103c897fd98
  • Need to enable People API - to work with contacts
    • Enable: https://console.developers.google.com/apis/library/people.googleapis.com?
    • Note: For read and write access to users' contacts, use the People API, which provides both contact and profile information using JSON instead of the older GData protocol.
  • Google Oauth2

    • Google Consele > credentials > Web client 1 > Authorized redirect URIs >> Add
    • To add and Authorized redirect URIs the domain must be added to the authorized domains list before submitting.
    • Google Consele > OAuth consent screen > Authorized domains >> Add Here
  • Action you can do after getting Google Contact access.

    • Methods: https://developers.google.com/people/api/rest/
    • CreateContact details: https://console.developers.google.com/apis/library/people.googleapis.com?project=contact-60659
    • Get user data: https://developers.google.com/people/api/rest/v1/people.connections/list?apix_params=%7B"resourceName"%3A"people%2Fme"%2C"personFields"%3A"emailAddresses"%7D
  • NOTE: Please keep safe your Client_id, Secret_id and API key



来源:https://stackoverflow.com/questions/49300549/python-adding-contact-on-google-contacts

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