people.connections.list not returning profile details and contacts in Python using Google-People API












0















I've connected with Google's People-API in the google console using oauth2.0 by creating credentials. And while I'm trying to get user's profile details and contact details by using this API in google, I'm not able to get that. Below is the sample code for the authentication and getting data.



import httplib2
from apiclient.discovery import build
from oauth2client.file import Storage
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.tools import run_flow

# Set up a Flow object to be used if we need to authenticate. This
# sample uses OAuth 2.0, and we set up the OAuth2WebServerFlow with
# the information it needs to authenticate. Note that it is called
# the Web Server Flow, but it can also handle the flow for
# installed applications.
#
# Go to the Google API Console, open your application's
# credentials page, and copy the client ID and client secret.
# Then paste them into the following code.
FLOW = OAuth2WebServerFlow(
client_id='xxxxxxxxx-xxxxxxxxxxxxxxxxx',
client_secret='xxxxxxxxxxxxxxxxxxxx',
scope='https://www.googleapis.com/auth/contacts.readonly',
user_agent='myapp/2.0',
redirect_uri='http://localhost')

# If the Credentials don't exist or are invalid, run through the
# installed application flow. The Storage object will ensure that,
# if successful, the good Credentials will get written back to a
# file.
storage = Storage('info.dat')
credentials = storage.get()
if credentials is None or credentials.invalid == True:
credentials = run_flow(FLOW, storage)

# Create an httplib2.Http object to handle our HTTP requests and
# authorize it with our good Credentials.
http = httplib2.Http()
http = credentials.authorize(http)

# Build a service object for interacting with the API. To get an API key for
# your application, visit the Google API Console
# and look at your application's credentials page.
people_service = build(serviceName='people', version='v1', http=http)

connections = people_service.people().connections().list('people/me', pageSize=100, personFields='names,emailAddresses').execute()
profile = people_service.people().get('people/me', pageSize=100, personFields='names,emailAddresses').execute()


After running the above code. I got the following error.



Traceback (most recent call last):
File "people_api_auth.py", line 43, in <module>
connections = people_service.people().connections().list('people/me', pageSize=100, personFields='names,emailAddresses').execute()
TypeError: method() takes 1 positional argument but 2 were given


Can anyone explain why I'm getting this error.
Any help would be greatly appreciated.
Thank you!!!










share|improve this question

























  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question.

    – Jacque
    Jan 3 at 5:28
















0















I've connected with Google's People-API in the google console using oauth2.0 by creating credentials. And while I'm trying to get user's profile details and contact details by using this API in google, I'm not able to get that. Below is the sample code for the authentication and getting data.



import httplib2
from apiclient.discovery import build
from oauth2client.file import Storage
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.tools import run_flow

# Set up a Flow object to be used if we need to authenticate. This
# sample uses OAuth 2.0, and we set up the OAuth2WebServerFlow with
# the information it needs to authenticate. Note that it is called
# the Web Server Flow, but it can also handle the flow for
# installed applications.
#
# Go to the Google API Console, open your application's
# credentials page, and copy the client ID and client secret.
# Then paste them into the following code.
FLOW = OAuth2WebServerFlow(
client_id='xxxxxxxxx-xxxxxxxxxxxxxxxxx',
client_secret='xxxxxxxxxxxxxxxxxxxx',
scope='https://www.googleapis.com/auth/contacts.readonly',
user_agent='myapp/2.0',
redirect_uri='http://localhost')

# If the Credentials don't exist or are invalid, run through the
# installed application flow. The Storage object will ensure that,
# if successful, the good Credentials will get written back to a
# file.
storage = Storage('info.dat')
credentials = storage.get()
if credentials is None or credentials.invalid == True:
credentials = run_flow(FLOW, storage)

# Create an httplib2.Http object to handle our HTTP requests and
# authorize it with our good Credentials.
http = httplib2.Http()
http = credentials.authorize(http)

# Build a service object for interacting with the API. To get an API key for
# your application, visit the Google API Console
# and look at your application's credentials page.
people_service = build(serviceName='people', version='v1', http=http)

connections = people_service.people().connections().list('people/me', pageSize=100, personFields='names,emailAddresses').execute()
profile = people_service.people().get('people/me', pageSize=100, personFields='names,emailAddresses').execute()


After running the above code. I got the following error.



Traceback (most recent call last):
File "people_api_auth.py", line 43, in <module>
connections = people_service.people().connections().list('people/me', pageSize=100, personFields='names,emailAddresses').execute()
TypeError: method() takes 1 positional argument but 2 were given


Can anyone explain why I'm getting this error.
Any help would be greatly appreciated.
Thank you!!!










share|improve this question

























  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question.

    – Jacque
    Jan 3 at 5:28














0












0








0








I've connected with Google's People-API in the google console using oauth2.0 by creating credentials. And while I'm trying to get user's profile details and contact details by using this API in google, I'm not able to get that. Below is the sample code for the authentication and getting data.



import httplib2
from apiclient.discovery import build
from oauth2client.file import Storage
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.tools import run_flow

# Set up a Flow object to be used if we need to authenticate. This
# sample uses OAuth 2.0, and we set up the OAuth2WebServerFlow with
# the information it needs to authenticate. Note that it is called
# the Web Server Flow, but it can also handle the flow for
# installed applications.
#
# Go to the Google API Console, open your application's
# credentials page, and copy the client ID and client secret.
# Then paste them into the following code.
FLOW = OAuth2WebServerFlow(
client_id='xxxxxxxxx-xxxxxxxxxxxxxxxxx',
client_secret='xxxxxxxxxxxxxxxxxxxx',
scope='https://www.googleapis.com/auth/contacts.readonly',
user_agent='myapp/2.0',
redirect_uri='http://localhost')

# If the Credentials don't exist or are invalid, run through the
# installed application flow. The Storage object will ensure that,
# if successful, the good Credentials will get written back to a
# file.
storage = Storage('info.dat')
credentials = storage.get()
if credentials is None or credentials.invalid == True:
credentials = run_flow(FLOW, storage)

# Create an httplib2.Http object to handle our HTTP requests and
# authorize it with our good Credentials.
http = httplib2.Http()
http = credentials.authorize(http)

# Build a service object for interacting with the API. To get an API key for
# your application, visit the Google API Console
# and look at your application's credentials page.
people_service = build(serviceName='people', version='v1', http=http)

connections = people_service.people().connections().list('people/me', pageSize=100, personFields='names,emailAddresses').execute()
profile = people_service.people().get('people/me', pageSize=100, personFields='names,emailAddresses').execute()


After running the above code. I got the following error.



Traceback (most recent call last):
File "people_api_auth.py", line 43, in <module>
connections = people_service.people().connections().list('people/me', pageSize=100, personFields='names,emailAddresses').execute()
TypeError: method() takes 1 positional argument but 2 were given


Can anyone explain why I'm getting this error.
Any help would be greatly appreciated.
Thank you!!!










share|improve this question
















I've connected with Google's People-API in the google console using oauth2.0 by creating credentials. And while I'm trying to get user's profile details and contact details by using this API in google, I'm not able to get that. Below is the sample code for the authentication and getting data.



import httplib2
from apiclient.discovery import build
from oauth2client.file import Storage
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.tools import run_flow

# Set up a Flow object to be used if we need to authenticate. This
# sample uses OAuth 2.0, and we set up the OAuth2WebServerFlow with
# the information it needs to authenticate. Note that it is called
# the Web Server Flow, but it can also handle the flow for
# installed applications.
#
# Go to the Google API Console, open your application's
# credentials page, and copy the client ID and client secret.
# Then paste them into the following code.
FLOW = OAuth2WebServerFlow(
client_id='xxxxxxxxx-xxxxxxxxxxxxxxxxx',
client_secret='xxxxxxxxxxxxxxxxxxxx',
scope='https://www.googleapis.com/auth/contacts.readonly',
user_agent='myapp/2.0',
redirect_uri='http://localhost')

# If the Credentials don't exist or are invalid, run through the
# installed application flow. The Storage object will ensure that,
# if successful, the good Credentials will get written back to a
# file.
storage = Storage('info.dat')
credentials = storage.get()
if credentials is None or credentials.invalid == True:
credentials = run_flow(FLOW, storage)

# Create an httplib2.Http object to handle our HTTP requests and
# authorize it with our good Credentials.
http = httplib2.Http()
http = credentials.authorize(http)

# Build a service object for interacting with the API. To get an API key for
# your application, visit the Google API Console
# and look at your application's credentials page.
people_service = build(serviceName='people', version='v1', http=http)

connections = people_service.people().connections().list('people/me', pageSize=100, personFields='names,emailAddresses').execute()
profile = people_service.people().get('people/me', pageSize=100, personFields='names,emailAddresses').execute()


After running the above code. I got the following error.



Traceback (most recent call last):
File "people_api_auth.py", line 43, in <module>
connections = people_service.people().connections().list('people/me', pageSize=100, personFields='names,emailAddresses').execute()
TypeError: method() takes 1 positional argument but 2 were given


Can anyone explain why I'm getting this error.
Any help would be greatly appreciated.
Thank you!!!







python-3.x http oauth google-people






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 4 at 6:13







Shravan Kumar

















asked Jan 2 at 10:19









Shravan KumarShravan Kumar

13




13













  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question.

    – Jacque
    Jan 3 at 5:28



















  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question.

    – Jacque
    Jan 3 at 5:28

















Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question.

– Jacque
Jan 3 at 5:28





Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question.

– Jacque
Jan 3 at 5:28












1 Answer
1






active

oldest

votes


















0














Take a look at the sample at https://developers.google.com/people/quickstart/python



Looks like they use list(resourceName='people/me' instead of list('people/me'






share|improve this answer
























  • yes, It worked. Thank you so much.

    – Shravan Kumar
    Jan 4 at 6:15











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54004553%2fpeople-connections-list-not-returning-profile-details-and-contacts-in-python-usi%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Take a look at the sample at https://developers.google.com/people/quickstart/python



Looks like they use list(resourceName='people/me' instead of list('people/me'






share|improve this answer
























  • yes, It worked. Thank you so much.

    – Shravan Kumar
    Jan 4 at 6:15
















0














Take a look at the sample at https://developers.google.com/people/quickstart/python



Looks like they use list(resourceName='people/me' instead of list('people/me'






share|improve this answer
























  • yes, It worked. Thank you so much.

    – Shravan Kumar
    Jan 4 at 6:15














0












0








0







Take a look at the sample at https://developers.google.com/people/quickstart/python



Looks like they use list(resourceName='people/me' instead of list('people/me'






share|improve this answer













Take a look at the sample at https://developers.google.com/people/quickstart/python



Looks like they use list(resourceName='people/me' instead of list('people/me'







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 3 at 18:53









Amos YuenAmos Yuen

8061314




8061314













  • yes, It worked. Thank you so much.

    – Shravan Kumar
    Jan 4 at 6:15



















  • yes, It worked. Thank you so much.

    – Shravan Kumar
    Jan 4 at 6:15

















yes, It worked. Thank you so much.

– Shravan Kumar
Jan 4 at 6:15





yes, It worked. Thank you so much.

– Shravan Kumar
Jan 4 at 6:15




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54004553%2fpeople-connections-list-not-returning-profile-details-and-contacts-in-python-usi%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Mossoró

Error while reading .h5 file using the rhdf5 package in R

Pushsharp Apns notification error: 'InvalidToken'