Django应用程序存储Google API OAuth凭证。
项目描述
将Google OAuth凭证存储在Django ORM中,以便于API服务访问。
安装
安装或添加 django-google-credentials 到您的Python路径。
将 google_credentials 添加到您的 INSTALLED_APPS 设置。
将 google_credentials URL包含添加到项目的 urls.py 文件
url(r'^google-credentials/', include('google_credentials.urls')),
在 Google API控制台 上创建您的项目,指定重定向URL为 http://your.domain.com/google-credentials/callback(或如上所述设置您的 urls.py)。
将以下设置添加到您的项目 settings.py 文件中,并用从Google获取的值填充,例如:
GA_CLIENT_ID = '32749234234.apps.googleusercontent.com' GA_CLIENT_SECRET = 'DKSFY87sd6fHJGdsf6' GA_SCOPE = 'https://www.googleapis.com/auth/analytics.readonly' GA_REDIRECT_URI = 'http://your.domain.com/google-credentials/callback'
运行 syncdb 以生成所需的模型。
用法
在您开始使用服务之前,您必须使用您的Google账户授权它。为此,请在您的浏览器中打开http://your.domain.com/google-credentials/authorize。
一旦授权,您可以按照以下方式检索服务以进行进一步查询
from google_credentials import utils service = utils.get_service()
要清除以前生成的凭据,请在您的浏览器中打开http://your.domain.com/google-credentials/purge。
关闭
django-google-credentials-0.0.2.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | dbef126c0e9fe29b4fa71fc3f69fdf5d34c9cb39efc3d48ccefd07e4ffddfc96 |
|
MD5 | 30281c4dfdba7574eb773c904ba1a780 |
|
BLAKE2b-256 | 01ac4fc1de17735b407e4f19ecaf929c493b9f92c0e138a8d337f227fc0d60b2 |
关闭
django_google_credentials-0.0.2-py2.7.egg的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 95834fd2373dbc75e2470fb1686d9aab2e7737e1997bb36e0acc2021807641ff |
|
MD5 | 8ee8e4a68c36a6c19204b705bf421459 |
|
BLAKE2b-256 | 2b9fcb91b2117bb25f1835d3240895ff858272073810154b1d0e564a46f13da4 |