Facebook/Twitter integration in python, where is the documentation? - python

I've searched on google and have taken a look at the facebook site for the apis, but facebook does not have an official SDK for python. I looked at the third party api for python listed on their site that could be used to communicate with facebook. After having visited their official site and github repository there is a small readme file that shows basic usage, it seems to assume that you are already connected to facebook, and the example at the end of that page shows a cookie example.
The short examples seem easy enough but there is no explaination of anything and i dont find any more documentation about anything else.. there does not seem to be any information about all available methods you can use with the api..where do the people who are using this api get the documentation to find the methods available so they are able to do work with this ?
Since i guess people are pretty tired of signing up for yet another service i would like to offer to sign in with their facebook and twitter accounts (although thats a no no for the ad people who would like to have access to the user profile in order to have targeted words/links that generate revenue). Im using django and have taken a look at the django-facebook api as well but the documentation seems to just point to the github repository which doesnt have any documenation, almost just like the other api pointed out above. Basically i dont find any documenation about how to use the apis except from the small examples.
And like always, i appericiate your time answering this, always nice to add an explaination to any code so the answer is a little more usefull, thanks.

My info might be a little bit out of date as I was working at a startup implementing a Python backend on Google AppEngine that interfaced with Facebook, used FQL, AppEngine datastore etc, about a year and half ago.
There are several third party APIs you can use, for instance, https://github.com/jgorset/facepy or https://github.com/pythonforfacebook/facebook-sdk. The reason there is no 'documentation' on the github site is because it implements access to the API that IS documented on Facebook's developer pages https://developers.facebook.com/docs/graph-api/.
But that is in a perfect world. My experience with the Facebook APIs is that they don't always do what is said on the dev pages. You don't get consistent return data, FB Realtime API not/inconsistently notifying for certain connections (music, movies, books, tv). Unfortunately, I think they have many non-documented APIs that are only available to the big app players.
Where I got my real world working info and learned how to access Facebook using Python was right here on stack overflow.

Related

API endpoint confusion

Disclaimer: I am new to working with APIs
I am working on leveraging gimbals API and am trying to figure out what exactly end points are? I realize that they link to a server, but how exactly are they used in development?
Are the endpoints used to link to specific sources of data?
I am using python(django) and it would be great to understand exactly how access and or change information on gimbals end.
PS- When looking at the gimbal api, I noticed that they have a REST api and some other mobile stuff going on. If I am building a web platform, I would only be interested in the REST API portion correct?
An endpoint in a RESTful API is generally just a URL. The URL represents some kind of resource. If it was an order processing API, the resources would be things like customers, orders, etc.
You interact with these resources by making HTTP requests of various sorts; GET if you want to know the content of a resource, POST if you want to change something, and so on. Have a look at this for basic information on REST and web APIs.
You don't need Django to interact with a RESTful API that someone else provides. All you really need is python's urllib, and maybe the json module, if they're sending the data in JSON. The REST API they provide is probably the main thing they want developers using, but if they have multiple APIs then it's hard to say which one is right for you without understanding the application better.

Open Source Search UI projects that can be consume REST services

I'm trying to find a solution to my current problem. Let me explain: I need to find a Search UI that can consume a REST service of my choice and be highly configurable. I've searched the web and found Blacklight Search UI (written in Ruby) for Solr. I've also looked at Haystack (for django) which seems to be more promissing because somewhere in the docs i found out that you can link Haystack to your custom search engine. Out of the box Haystack supports Solr, Xapian and 2 others which i can't remember now.
What i'm trying to find is a UI written in Java, PHP(last resort!) or Python that will allow me to specify the endpoints for my APIs and with a few configurations (i'm not expecting it to run out of the box) it should be able to query the APIs and return results.
If that is not possible then could somebody suggest me something that gets close to what I described and allows me to write my own backend code that will link to the APIs ? A Haystack example will also do...
Thanks
I'm interested in this topic as well. I know about the SESAT framework supporting FAST, Solr, Yahoo!, generic XML and more, but it is old and not well maintained, and also tries to do much more than a simple front-end.
You also have AJAX-Solr which obviously only supports Solr.
I have forwarded your question on Twitter, hope others will fill in as well.

Simple API's to play around with for Python/Django?

Does anyone know of simple and well documented API's with plenty of hand holding examples that assumes very little or no prior knowledge of web development?
I've been messing around with Pyfacebook and Facebook-Python-SDK in trying to create a simple photo display app but I haven't been able to make much headway after spending the last few days on it. The main reason for this is simply because I just wasn't able to find a good tutorial that walks me through all the steps. So, I'm putting this mini project on pause and looking for lower hanging fruit.
In terms of skill level, I'm pretty ok on the basics of Python and Django.
Update
I've done the tutorials at http://www.djangoproject.com/ already. Really looking for ideas and suggestions on webapp projects that utilises an API. E.g, a twitter app that displays a user's most frequently used keywords in a tagcloud.
Update2
Side note: Having mess around with Twitter's API for a little bit, I would definitely recommend to start with Twitter first as opposed to Facebook. It's easier and better documented.
Best place to start is with tutorials on djangoproject.com.
Have you tried the Django tutorial? It is pretty basic, but touches on all important points required to develop your own basic app.
django-basic-apps contains a collection of apps you might enjoy reading.
Edit: Check out this good list of web services I found. :)
As far as I know you can't write facebook apps with Django. Facebook uses their own API and stuff. They are completely different.
And for the twitter API thingy I have an idea.
Develop a django app which can used to
scrap and backup tweets.
The scenario is during any FOSS
conference, they are using a #hastag
to identify tweets related to that
conf. But after sometime these tweets
don't show up even on search. For
example we used #inpycon2010 tag for
Pycon conf in India. But now when I
search for this tag, nothing shows up.
So what you can do allow users to
register a hastag and set a time
interval. Within that time interval
your app should scrap all the tweets
and backup them. The user should be
able to retreive from that later.
If you start this a foss project, I'm ready to jump in :)

use python / django to let users login to my site using their google credentials

I want to let users use their google account to login to my website. Exactly the way SO lets me. Can anyone please point in the right direction? I'm assuming the oAuth library is to be used but what I'd really like is a snippet of code I can directly copy paste and get this to work.
It's not OAuth particularly that you need (OAuth is for authorising access for one website to specific private content held on another), but OpenID - which is meant for authentication rather than authorisation. (Some sites, like Twitter, do provide authentication services via OAuth, but that's not what it's primarily for.) I have used python-openid which is fairly straightforward to use, or you can look at django-openid - though it admits to being incomplete, you could get some idea of how to implement OpenID support.
The problem's a little too involved to admit a copy-and-paste solution, but it's not especially hard to do this.
Update: piquadrat's link (in he comment) is definitely worth following.
You may want to check out django-piston which is a mini-framework with oAuth built in. Here's a tutorial on how to set it up.
You might consider using Django-Socialauth, as it supports
Twitter
Gmail
Facebook
Yahoo (essentially openid)
OpenId

Noob Question: Python + Twitter + App Engine - Oauth

I'm sorry but I'm having some trouble implementing Oauth within my app engine python project.
I've been working from http://github.com/tav/tweetapp, but I don't think I have a strong enough grasp on this platform to understand how to implement this class within my main.py I'm building the rest of my app in.
This maybe a feeble attempt, but here is what I have so far:
twa = twitter_auth
client = twa.OAuthClient('twitter')
I've created a source folder within my project called "twitter_auth" and that contains a file within it called "twitter_auth.py" which contains the above linked library, and a file called __ init__.py (no space) which is completely empty.
I really have no idea what to do from here :/
Let me recommend taking a look at the tweepy library and some example tweepy apps. Specifically here: http://github.com/wasauce/tweepy-examples
This shows how to use oauth to authenticate a user: http://github.com/wasauce/tweepy-examples/tree/master/appengine/oauth_example/
As Hagge said, it sounds like your issue is more with the tweetapp library than with App Engine. However, if you would like to know more about OAuth on App Engine and if I may be allowed to link to myself, my two articles on the topic seem to be reasonably popular.
The tweetapp library was a an early prototype for Twitter OAuth on twitter. Tav did the heavy lifting and I deployed the site http://twitteroauth.appspot.com , using some of the tweetapp library. The actual source of that site is here (I need to update the site to point here): http://github.com/ryanwi/twitteroauth
I am still using it in production, but, it has aged and does not work for all API calls. I'd recommend trying a different, more up to date and maintained library as others have mentioned.
But, take a look at the twitteroauth source if you want to try to get a first attempt working.
These two are on Twitter's list
http://github.com/brosner/python-oauth2
http://code.google.com/p/oauth-python-twitter2/
I'm not familiar with that library, but after a quick look and seeing the warning that it is not maintained I'd search for something better. I implemented a simple Twitter connection based on Tornado's auth: see an example of how to make Twitter API calls here (and an authentication example here). In case you don't want to use tipfy, I recommend implementing the python-twitter library in your framework of choice.

Categories