Py学习  »  Django

Django Google api客户端库oauth2client-未解析的引用流场

jsk • 4 年前 • 437 次点击  

在google api客户端文档中,提供了一个在django中使用api客户端库的示例 here

我试图按如下方式使用提供的代码段:

from django.contrib.auth.models import User
from django.db import models
from oauth2client.contrib.django_orm import FlowField

class FlowModel(models.Model):
  id = models.ForeignKey(User, primary_key=True)
  flow = FlowField()

导入 from oauth2client.contrib.django_orm import FlowField 但是在PyCharm中产生一个错误:

未解析的参考流场

在github存储库中查找 googleapis/oauth2client 我找不到任何有关流场的资料

我做错什么了?

(我已经用pip安装了需求,并且有一个正在运行的django应用程序)

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/50097
 
437 次点击  
文章 [ 2 ]  |  最新文章 4 年前
Andrey Zavodov
Reply   •   1 楼
Andrey Zavodov    4 年前

如上所述,此库被标记为已弃用,但您可以运行以下命令来修复它:

$ pip install --upgrade oauth2client
ScottMcC
Reply   •   2 楼
ScottMcC    5 年前

根据此链接: https://oauth2client.readthedocs.io/en/latest/

oauth2client现在已被弃用。 没有更多的功能将添加到库中,核心团队正在拒绝支持。我们建议您使用 google-auth oauthlib . 有关否决的更多详细信息,请参阅oauth2client否决。

另请参阅以下GitHub对话: https://github.com/googleapis/oauth2client/issues/686#issuecomment-268083225

要将OAuth与Django一起使用,可以考虑使用 django-oauth-toolkit 图书馆: