What python library I should use for facebook OAuth and OpenGraph - python

I have designed a Facebook application and need to add OAuth, Open Graph for complete functionality. Considering that I know nothing about Open Graph and little JS, I'd like to use a small wrap-up (python lib) which will provide the those features..
I searched over Google, stackoverflow and found few projects which provide some cool features but I am unable to choose..
python libs:
django-social-auth
fandjango
facepy
pyFacebook - I think this doesn't offer OAuth.
I also use Google Data API in my project. So, the better option would be django-social-auth but I am not sure if I can do Open Graph with it..
Can anyone tell me what is the best, maintained, good lib?
(Please do mention if its not in the above list)

django-social-auth is really great if you want to build a website that allows users to log in with Facebook, but if you're building an application on Facebook.com you probably want to use something like fandjango. Either way, you will need a different kind of library (like, say, facepy) to interact with Facebook's API once you've retrieved an access token from the user.
Full disclosure: I am the author of fandjango and facepy.

I would highly suggest django-social-auth. Any library than can parse JSON will support Open Graph as FQL and Graph API data can all be retrieved from Facebook's API (REST).
Good luck!

Related

OAUTH2 Python Facebook Login

I am new to web programming- I've recently been familiarizing myself with the webapp2 framework. I'm trying to start building a website, and would like users to login to the site with Facebook and I'll need access to their friends list. I've been trying to find a way to do this- I found out about OAUTH2, and I think this may be a way to do this. All the tutorials for python and OAUTH2 that I've found have been using the google API, I'm not sure if it's any different, but I haven't been able to get it to work.
Does anyone have sample code they can post that uses OAUTH2 (or anything else) to get users to sign in through Facebook? Or any good resources that can help me with this?
Your app needs to authorize users with Facebook, since there's where the resources you need are (e.g. friend lists).
This is a classic use of OAuth2 and you don't have a way around it, because FB implements this protocol.
My suggestion is that you look at the Google sample and then adjust it for FB API. The important changes are:
The endpoint URLs (e.g. authorize, token and user profile
The scopes that define the extent of permissions you are requesting (e.g. list of friends)
The user profile (e.g. the information returned by FB on a user: name, e-mail, etc)
This is a very simple sample that does this in Python. It was meant to run in Google App Engine. The only caveat is that it uses our own library to encapsulate the flow. But you can use it to study how the basic protocol works. Run the live demo and turn on dev tools on your browser to see the network activity.
You will notice that OAuth2 is a rather simple protocol, using simple HTTP requests.

Python libraries for integrating Django with Facebook

I decide to write some applications using facebook and django (or even twisted, but it doesn't matter), and now I can't choose appropriate tools. I see there are many API-wrappers writed on Python exists for Facebook:
official, but seems no longer supported Python-SDK
new and actively developed, but seems too new Django-facebook
good old, but not maintained pyfacebook
simple, well-maintaned, but non-documented fandjango
some other very primitive tools
I saw some similar questions here, but I'm noticed that Facebook is periodically introduces big changes into their API and those advices may be already outdated, or may be new libraries appeared.
Also I'd like to know about most significant differences between those libraries. And of course good documentation and tutorials are welcome.
I think Django Facebook is a good choice for you. But my opinion is biased. I've written it for my startup Fashiolista.com and we run it in production. (Quite huge, so most edge cases have been resolved)
Django Facebook also include OpenFacebook, which is a python api client to the open graph protocol. It's the only python client I know which is fully up to date and actively maintained.
Have a look at:
https://github.com/tschellenbach/Django-facebook
PS.
Just released some new decorators which make it very simple to get started. These decorators are indeed very new and caused some bugs in the past days. The project itself is already a year old (since the open graph api was released) and otherwise quite stable.
http://www.mellowmorning.com/
The answer really depends on what it is you want to achieve as those APIs are pretty different.
pyfacebook - is for the older legacy API.
python-sdk - is for the "new" opengraph protocol (I wouldn't say its no longer supported as its just a thin wrapper over the facebook opengraph protocol, so supports all the new features that facebook provide instantly w/out needing dev work on the lib).
django-facebook - is a higher level than python-sdk and helps you to add facebook connection features to your site and also seems to pave the way to creating apps that live "inside" facebook rather than just helping sites that live outside facebook to get access to facebook data.
Never heard of fandjango and github seems to be down at the moment so can't comment on that.
If you just want to add user-login using facebook then something like django-socialauth might work out well for you.
If you want to start exploring the social graph then python-sdk is the way to go.
I'd also check to see if the functions you want are supported by the opengraph protocol, its improved over the last year but there is the odd thing it frustratingly doesn't support whereas the legacy api does support...
The best documentation is facebook itself, check out the graph-explorer - it's pretty fascinating...
It depends what you are trying to do. I had the same problem and ended up using django-social-auth , which lets you log in via Facebook and many other social networks.It also lets you extract the token from those networks and then use it.
For the facebook specific stuff, I use facebook-sdk, but since you have something managing the tokens, you could really replace it with any library if yours become outdated in upcoming years . It also means you can add more social networks later on.

Facebook api in python and sources to master it!

I've good enough knowledge of python and I want to use facebook python api and for that I've got all the API key and App Secret etc from the developer site. Now what I want is a good source to provide me with good knowledge how to authenticate and retrieve data like statuses etc using the Python IDLE(in win7). I searched the google but unable to reliable one! Thanx people! :D
You probably want to use the python version of the facebook-sdk. It contains a few examples.

Bloomberg Server API and Ruby/Python

Im looking to write a new application in ruby/python which uses a feed from bloomberg and am stuck trying to find any documentation for using (or even setting up) Bloomberg Server API with either of these languages.
Does anyone have any good links to tutorials for this or maybe some boilerplate code to get set up? Or is it best to just stick to the three main supported languages?
The Bloomberg Open API (BLPAPI) v3.5 release now includes a native Python SDK.
http://www.openbloomberg.com/2012/11/21/open-api-blpapi-v3-5-x-released/
Did you check out some questions at SO on this. It might help you
Bloomberg API request timing out
Asynchronous data through Bloomberg's new data API (COM v3) with Python?
Resolver is an spreadsheet implementation in IronPython and has a very good integration for Bloomberg API
http://www.resolversystems.com/documentation/apidocs/MarketData_Bloomberg.html
Here is a simple Client access API which I wrote with the help of the mentioned links as well as some others. Not everything is implemented but it is a good start.
https://github.com/bpsmith/pybbg

Python (Django) Shopify API Client -- For a Beginner

I have a requirement to build a client for Shopify's API, building it in Python & Django.
I've never done it before and so I'm wondering if someone might advise on a good starting point for the kinds of patterns and techniques needed to get a job like this done.
Here's a link to the Shopify API reference
Thanks.
Your question is somewhat open-ended, but if you're new to Python or API programming, then you should get a feel for how to do network programming in Python, using either the urllib2 or httplib modules that come with more recent versions of Python. Learn how to initiate a request for a page and read the response into a file.
Here is an overview of the httplib module in Python documentation:
http://docs.python.org/library/httplib.html
After you've managed to make page requests using the GET HTTP verb, learn about how to make POST requests and how to add headers, like Content-Type, to your request. When communicating with most APIs, you need to be able to send these.
The next step would be to get familiar with the XML standard and how XML documents are constructed. Then, play around with different XML libraries in Python. There are several, but I've always used xml.dom.minidom module. In order to talk to an API, you'll probably need to know to create XML documents (to include in your requests) and how to parse content out of them. (to make use of the API's responses) The minidom module allows a developer to do both of these. For your reference:
http://docs.python.org/library/xml.dom.minidom.html
Your final solution will likely put both of these together, where you create an XML document, submit it as content to the appropriate Shopify REST API URL, and then have your application deal with the XML response the API sends back to you.
If you're sending any sensitive data, be sure to use HTTPS over port 443, and NOT HTTP over port 80.
I have been working on a project for the last few months using Python and Django integrating with Shopify, built on Google App Engine.
Shopify has a valuable wiki resource, http://wiki.shopify.com/Using_the_shopify_python_api. This is what I used to get a good handle of the Shopify Python API that was mentioned, https://github.com/Shopify/shopify_python_api.
It will really depend on what you are building, but these are good resources to get you started. Also, understanding the Shopify API will help when using the Python API for Shopify.
Shopify has now released a Python API client: https://github.com/Shopify/shopify_python_api
I think you can find some inspiration by taking a look at this:
http://bitbucket.org/jespern/django-piston/wiki/Home
Although it is directly opposite what you want to do (Piston is for building APIs, and what you want is to use an API) it can give you some clues on common topics.
I could mention, of course, reading obvious sources like the Shopify developers forum:
http://forums.shopify.com/categories/9
But I guess you already had it in mind :)
Cheers,
H.

Categories

Resources