Facebook 放弃了对 Python 的支持吗?

发布于 2024-12-21 10:45:41 字数 496 浏览 4 评论 0原文

Python SDK 似乎已从 Github 中删除。 https://github.com/facebook/python-sdk 返回 404。

他们是否移动了在其他地方开发,放弃支持,或者这只是一个错误?开发者网站仍然链接到 Github(请参阅 https://developers.facebook.com/opensource/)但这并没有多大意义。

有人有克隆吗?

编辑

我意识到 API 仍然可用,但这不是重点。许多第三方软件包都依赖于 SDK(例如 django-socialregistration)。删除存储库破坏了所有这些(因为它通常是包要求),这反过来又破坏了站点部署。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一梦浮鱼 2024-12-28 10:45:41

要回答克隆问题,是的:

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

这是截至昨天的最新情况。

To answer the clone question, yes:

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

This is as recent as of yesterday.

伪心 2024-12-28 10:45:41

Facebook 的回应

Facebook 的官方回应是

我们不再支持或提供官方 Facebook Python SDK。您可以找到几个适用于 Python 的非官方 SDK,或者您可以直接使用简单的 urllib.urlopen 调用 Graph API。

来源:https://developers.facebook.com/bugs/200182333402545

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

风吹雨成花 2024-12-28 10:45:41

不,您可以通过 urlread 函数使用 Facebook 图形 api。您所需要做的就是使用 Javascript 从用户处获取访问令牌,FB 开发人员网站上有相关文档。以下是如何使用 URL lib 函数的示例



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)

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)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文