__init__.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:PythonStudyCode 作者: TongTongX 项目源码 文件源码
def get_version(self):
        """Fetches the current version number of the Graph API being used."""
        args = {"access_token": self.access_token}
        try:
            response = requests.request("GET",
                                        "https://graph.facebook.com/" +
                                        self.version + "/me",
                                        params=args,
                                        timeout=self.timeout,
                                        proxies=self.proxies)
        except requests.HTTPError as e:
            response = json.loads(e.read())
            raise GraphAPIError(response)

        try:
            headers = response.headers
            version = headers["facebook-api-version"].replace("v", "")
            return float(version)
        except Exception:
            raise GraphAPIError("API version number not available")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号