Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9071553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:56:45+00:00 2026-06-16T17:56:45+00:00

What possible ways to import google contacts using python and oauth2.0 exists? We successfully

  • 0

What possible ways to import google contacts using python and oauth2.0 exists?

We successfully got credentials, and our application requests access to contacts, but after getting credentials I can’t find way to discover contacts api.

So things like:

 from apiclient.discover import build
 import httplib2
 http = httplib2.Http()
 #Authorization
 service = build("contacts", "v3", http=http) 

Gives us UnknownApiNameOrVersion exception.
It looks like Contacts API not in list of supported APIs for apiclient.

I’m looking for alternative ways.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T17:56:46+00:00Added an answer on June 16, 2026 at 5:56 pm

    The Google Contacts API can’t be used with the google-api-python-client library because it is a Google Data API, while google-api-python-client is intended to be used with discovery-based APIs.

    Rather than going through all the trouble described by @NikolayFominyh, you can use the native support for OAuth 2.0 in gdata-python-client.

    To get a valid token, follow the instructions from a Google Developers blog post for an in-depth description of the process.

    First, create a token object:

    import gdata.gauth
    
    CLIENT_ID = 'bogus.id'  # Provided in the APIs console
    CLIENT_SECRET = 'SeCr3Tv4lu3'  # Provided in the APIs console
    SCOPE = 'https://www.google.com/m8/feeds'
    USER_AGENT = 'dummy-sample'
    
    auth_token = gdata.gauth.OAuth2Token(
        client_id=CLIENT_ID, client_secret=CLIENT_SECRET,
        scope=SCOPE, user_agent=USER_AGENT)
    

    Then, authorize your application with this token:

    APPLICATION_REDIRECT_URI = 'http://www.example.com/oauth2callback'
    authorize_url = auth_token.generate_authorize_url(
        redirect_uri=APPLICATION_REDIRECT_URI)
    

    After generating this authorize_url, you (or users of your application) will need to visit it and accept the OAuth 2.0 prompt. If this is within a web application, you can simply redirect, otherwise you’ll need to visit the link in a browser.

    After authorizing, exchange the code for a token:

    import atom.http_core
    
    redirect_url = 'http://www.example.com/oauth2callback?code=SOME-RETURNED-VALUE'
    url = atom.http_core.ParseUri(redirect_url)
    auth_token.get_access_token(url.query)
    

    In the case you visited a browser, you’ll need to copy the URL you were redirected to into the variable redirect_url.

    In the case you are in a web application, you will be able to specify the handler for the path /oauth2callback (for example) and simply can retrieve the query parameter code to exchange the code for a token. For example, if using WebOb:

    redirect_url = atom.http_core.Uri.parse_uri(self.request.uri)
    

    Finally authorize your client with this token:

    import gdata.contacts.service
    
    client = gdata.contacts.service.ContactsService(source='appname')
    auth_token.authorize(client)
    

    Update (12+ months after original answer):

    Alternately you can use the google-api-python-client support as I describe in a blog post.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: private members in python I've got few variables I really want to
There are about 100,000 different possible ways to encrypt a string. Using standards like
Is there any possible ways to change the shape of the TextView using themes
Possible Duplicate: changing import name in python In Pymel, when i access a class
Until now it was possible to import data into an iPhone app using iTunes
Possible ways: Using push : my @list; push @list, 'foo' if $foo; push @list,
What are possible ways to save string arrays to a stream without using serialization?
I'm investigating the possible ways of obtaining superuser privileges in a Java Android application
There are several possible ways of getting the path to the application data directory:
Searching for possible ways to get cookie with httpOnly enabled, I cannot find any.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.