7

The Python SDK seems to have been removed from Github. https://github.com/facebook/python-sdk returns a 404.

Have they moved the development somewhere else, dropped support, or is this just a mistake? The developer site still links to Github (see https://developers.facebook.com/opensource/) but that doesn't really mean much.

Does anyone have a clone?

Edit

I realise the API is still available but that's not really the point. Lots of third party packages rely on the SDK (like django-socialregistration). Deleting the repository has broken all of these (since it's often a package requirement) which, in turn, breaks site deployments.

devioustree
  • 231
  • 2
  • 7
  • you can use the graph api directly, you shouldn't need an sdk. – Joseph Le Brech Dec 16 '11 at 11:10
  • 2
    Lots of third party packages rely on it (like django-socialregistration). Deleting the repository has broken all of these which, in turn, breaks site deployments. – devioustree Dec 16 '11 at 11:15
  • 1
    I have a clone. https://bitbucket.org/schinckel/facebook-python-sdk It's a bit old, but I've been using it with django-socialregistration for months. – Matthew Schinckel Dec 16 '11 at 11:43
  • My understanding of the response I got from attempting to clone the repo is that it is now private. – Matthew Schinckel Dec 16 '11 at 11:44
  • 1
    I've filed a bug report here https://developers.facebook.com/bugs/200182333402545 – devioustree Dec 16 '11 at 12:10
  • possible duplicate of [What happened to the facebook-sdk git repository for python (facebook.py)?](http://stackoverflow.com/questions/8531494/what-happened-to-the-facebook-sdk-git-repository-for-python-facebook-py) – Georg Fritzsche Dec 16 '11 at 23:22

3 Answers3

2

To answer the clone question, yes:

https://github.com/flashingpumpkin/facebook-sdk-fork

This is as recent as of yesterday.

1

Response From Facebook

The official response from Facebook is

We longer support or provide an official Facebook Python SDK. You can find several unofficial SDKs for Python, or you could use simple urllib.urlopen calls direct to the Graph API.

Source: https://developers.facebook.com/bugs/200182333402545

devioustree
  • 231
  • 2
  • 7
0

No, you can use the Facebook graph api using the urlread functions. All you need to do is to get an access token from the user using Javascript, there is documentation on the FB developer site for this. Here's an example of how to use the URL lib functions



class Facebook(object):

    def __init__(self, auth_token):
        self.auth_token = auth_token

    def load(self, method, user_id = 'me'):
        raw = urlopen("https://graph.facebook.com/%s/%s/?access_token=%s" % (user_id, method, self.auth_token)).read()
        data = loads(raw)
        return data['data'] or []

    def with_fields(self, method, user_id = 'me', fields = 'name,likes'):
        raw = urlopen("https://graph.facebook.com/%s/%s/?fields=%s&access_token=%s" % (user_id, method, fields, self.auth_token)).read()
        data = loads(raw)
        return data['data'] or []

    def likes(self, user_id = 'me'):
        return self.with_fields('likes', user_id, 'name,category')

    def me(self):
        data = loads (urlopen("https://graph.facebook.com/me?fields=name&access_token=%s" % self.auth_token).read())
        return data or {}

    def expand(self, like):
        data = loads (urlopen("https://graph.facebook.com/%s?access_token=%s" % (like['id'], self.auth_token)).read())
        return data or {}

    def friends(self, user_id = 'me'):
        return self.load('friends', user_id)

    def movies(self, user_id = 'me'):
        return self.with_fields('movies', user_id)

    def music(self, user_id = 'me'):
        return self.with_fields('music', user_id)

    def picture(self, user_id='me', size=None):
        if size:
            return "https://graph.facebook.com/%s/picture?access_token=%s&type=%s" % (user_id, self.auth_token, size)
        return "https://graph.facebook.com/%s/picture?access_token=%s" % (user_id, self.auth_token)
abc def foo bar
  • 2,360
  • 6
  • 30
  • 41
  • 3
    I realise the API is still available but that's not really the point. Lots of third party packages rely on the SDK (like django-socialregistration). Deleting the repository has broken all of these which, in turn, breaks site deployments. – devioustree Dec 16 '11 at 13:23