Question

I'm trying to use gdata in order to get the contact from my users on my site.

so far I have made a pip install gdata.

Then I added on top of my views.py

CLIENT_ID = 'mythingy'  # Provided in the APIs console
CLIENT_SECRET = 'mythingy'  # Provided in the APIs console
SCOPE = 'https://www.google.com/m8/feeds'
USER_AGENT = 'dummy-sample'

I have a button on my page that doesn nothing but I would like that if you click it it should ask you for persmission then open a pop up with the gmail contact of the user.

I would like to know how to implement htat.

in my views so far I have:

@login_required
def activate_user(request, activation_key):

   user = User.objects.get(username=request.user)
   profile = user.get_profile()
   auth_token = gdata.gauth.OAuth2Token(client_id=CLIENT_ID,client_secret=CLIENT_SECRET,scope=SCOPE,user_agent=USER_AGENT)

    APPLICATION_REDIRECT_URI = 'http://127.0.0.1:8000/oauth2callback'
    authorize_url=auth_token.generate_authorize_url(redirect_uri=APPLICATION_REDIRECT_URI)

    return render_to_response('registration/activation_complete.html',{'user': user,'profile':profile}, context_instance=RequestContext(request))

But this does nothing. I haven't touch my urls.py or my settings.py Thank you

Was it helpful?

Solution

I end up using the javascript API. If anyone needs the code let me know

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top