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.

有帮助吗?

解决方案 2

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

其他提示

To answer the clone question, yes:

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

This is as recent as of yesterday.

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)
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top