How to use sign-in quota (plus.login scope) for Google Plus
Question: I wrote a scraper to get some of the users' public contents. This scraper
fetches the comments, plusoners, resharers, and the user's post. The free
quota is 10,000 requests/day if you use API key:

    
    
       service = apiclient.discovery.build(service_name, service_version,
                                                 developerKey=api_key)
    

I'd like to use Sign-in quota to fetch plusoners and resharers (people.list
API call). But I couldn't use oauth for this purpose. That is, I don't have
any users. I'd like to use the scope
(<https://www.googleapis.com/auth/plus.login>) for fetching plusoners and
resharers.

In Java, I think the procedure is this:
<https://developers.google.com/android/reference/com/google/android/gms/common/api/GoogleApiClient.Builder>.

How can I do it for Python?


Answer: There is really lots of documents how to authenticate it with Oauth2.0 but
there isn't so much information about how a server side script can
authenticate itself without any human presence.

I think I found the most convenient way of doing it with JWT.

    
    
    from apiclient.discovery import build
    from httplib2 import Http
    from oauth2client.client import SignedJwtAssertionCredentials
    
    private_key = open("MyProject.p12").read() 
    client_email = 'EMAIL'
    http_auth = credentials.authorize(Http())
    credentials = SignedJwtAssertionCredentials(client_email, private_key, 'https://www.googleapis.com/auth/plus.login')
    service.people().list(userId='me', collection='connected').execute()
    

_Note for people who are not careful like me_ : Moreover, this authentication
method doesn't useful for me because it's for people().list API calls.
However, I'd like to use people().listByActivity.

