PyData用于验证Google API的助手
项目描述
pydata-google-auth是一个提供验证Google API助手功能的包。
安装
通过conda安装最新发布版本
$ conda install pydata-google-auth --channel conda-forge
通过pip安装最新发布版本
$ pip install pydata-google-auth
安装最新开发版本
$ pip install git+https://github.com/pydata/pydata-google-auth.git
用法
使用pydata_google_auth.get_user_credentials()函数使用用户凭据验证Google API。
import pydata_google_auth
credentials = pydata_google_auth.get_user_credentials(
['https://www.googleapis.com/auth/cloud-platform'],
)
# Use the credentials in other libraries, such as the Google BigQuery
# client library.
from google.cloud import bigquery
client = bigquery.Client(project='YOUR-PROJECT-ID', credentials=credentials)
有关更多详细信息,请参阅pydata-google-auth文档。