Google Api Client

153 views
Skip to first unread message

madhusona

unread,
Aug 17, 2018, 11:34:59 AM8/17/18
to Django users
Hi

Am trying to implement Google API client for Django. I am following the link https://developers.google.com/api-client-library/python/guide/django but it was not working. Amusing python 3.5 and Django 2.0. It is very helpful if there is a new user manual to implement Django google API client.

Jason

unread,
Aug 17, 2018, 12:21:34 PM8/17/18
to Django users
"not working" is a very vague description of your problem and not helpful at all in diagnosing the issue.  give some details.

when asking for help, the your job is to describe your problem in such a way that it gives enough information for others to identify possible things you're doing wrong..  I suggest you read https://stackoverflow.com/help/how-to-ask and incorporate that into how you ask for help.

madhusona

unread,
Aug 17, 2018, 12:39:18 PM8/17/18
to Django users

In Django I implemented social login using the social auth app and I followed this link to configure it. Goolge OAuth is working good; google-oauth2 access token is stored in extra data field.

Now I want to list google drive files using this access token. I tried with this.

def drive(request):
    user = request.user
    social = user.social_auth.get(provider='google-oauth2')
    response = requests.get(
        'https://www.googleapis.com/auth/drive.metadata.readonly',
        params={'access_token': social.extra_data['access_token']})
    print(response)
    return render(request, 'home/drive.html', {'checking':response})

I am getting a 200 response, but I don't know how to list files.

I'm using django 2.0.3 and python 3.5.

Andréas Kühne

unread,
Aug 19, 2018, 8:03:50 AM8/19/18
to django...@googlegroups.com
If you are getting a 200 response - then the request has succeeded without any errors - therefore this is more about handilng the response from the google api.

You will need to look at the google api docs to see what is returned by the REST endpoint. 

This is not a django issue, but more how to read information from google drive api. I would suggest you either search for the information or post on stackoverflow, or search the google api forums.

Regards,

Andréas

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7f7ff58d-2895-496a-ada1-d255d5f6ccf6%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Jason

unread,
Aug 19, 2018, 11:16:49 AM8/19/18
to Django users
If you are getting a 200 response - then the request has succeeded without any errors - therefore this is more about handilng the response from the google api.

Unless 200 is the default response from the API.  I know its unlikely, being a Google API, but I have worked with several APIs that explicitly return everything 200 and force consumers to rely on parsing message details for errors.  So yes, a 200 response should indicate successful request, but don't take that as fact until verifying with the API docs.
Reply all
Reply to author
Forward
0 new messages