Search code examples
pythonfacebooktwitterauthenticationgoogle-account

Log-in to a website using Google, Facebook or Twitter accounts with Python


I am making a web application that will monitor the amount of members and discussions in each one of the groups listed here (http://www.codecademy.com/groups#web) and display that information in nice graphs.

However, as you have already seen, it looks like I need to create an account and login with it.

Having in mind that my project is using Python for the server side, how do I do it? Which API is easier? (Google, FB or twitter?)

I would really love if you could also provide some examples because I am really new at this (and at Python too).


Solution

  • The official wrapper around the Twitter API for Python is this one. I used it and it's very easy. You should first read this page and also register an application to get OAuth keys.

    Example:

    import twitter
    
    # Remember to put these values
    api = twitter.Api(consumer_key="",
                      consumer_secret="",
                      access_token_key="",
                      access_token_secret="")
    
    # Get your timeline
    print api.GetHomeTimeline()
    

    Hope it helps.