草庐IT

python - 如何从备用源创建 Google API OAuth Credentials 对象

我正在使用这个简单的GoogleAPI示例:importhttplib2fromapiclient.discoveryimportbuildfromoauth2client.clientimportflow_from_clientsecretsfromoauth2client.fileimportStoragefromoauth2client.toolsimportrun#Pathtotheclient_secret.jsonfiledownloadedfromtheDeveloperConsoleCLIENT_SECRET_FILE='client_secret.json'#Chec

python - 如何使用 oauth2 并通过 google api 刷新 token ?

所以我最近几天一直在努力解决这个问题并提出这个问题,以便我可以为遇到问题的其他人解答。首先,谷歌文档很糟糕,并且根据您正在查看的许多谷歌API示例中的哪一个,使用不同的oauth2库。它通常是自相矛盾的,有时直接包含不起作用的代码。好吧。所以我的问题基本上是:如何使用googleapi库让我的用户授予我访问他们的google帐户的权限?如何存储google返回的oauth2访问token,以便我可以在几天后使用它们?我如何实际使用refresh_token并刷新它?请参阅下面的答案以了解功能齐全的授权流程,从获取初始token到保存它、稍后加载它、刷新它和使用它。干杯。

python - ('Unexpected credentials type',无, 'Expected', 'service_account')与 oauth2client(Python)

我正在尝试通过本指南获取GoogleAnalytics数据:https://ga-dev-tools.appspot.com/embed-api/server-side-authorization/defget_access_token(request):return{'access_t':ServiceAccountCredentials.from_json_keyfile_name(KEY_FILEPATH,SCOPE).get_access_token().access_token}使用上面的代码,我尝试创建一个函数并将访问token返回到我的管理模板中的上下文。但是。我收到此错

找不到 linkedin oauth2 的 python-social-auth 后端

我正在尝试使用python-social-auth将linkedinoauth2合并到我的应用程序中。但是,当我在Chrome中导航到127.0.0.1:8000/login/linkedin/时,出现“找不到后端”错误。具体来说,日志显示以下错误:[08/Sep/201416:44:38]"GET/login/linkedinHTTP/1.1"3010[08/Sep/201416:44:38]"GET/login/linkedin/HTTP/1.1"4041608我的settings.py中有以下相关代码:INSTALLED_APPS=('django.contrib.admin',

python - xauth 使用 python-oauth2

我正在尝试使用python-oauth2为instapaper实现xauth。我能够找到oauth的样本,但我没有找到xauth的样本。有人可以分享示例或api文档吗? 最佳答案 这是最终为我工作的代码consumer_key=consumer_secret=access_token_url='https://www.instapaper.com/api/1/oauth/access_token'consumer=oauth.Consumer(consumer_key,consumer_secret)client=oauth.Cli

python - 用于 OAuth 身份验证的 WSGI 中间件

我已经使用Flask构建了一个非常小的Web应用程序.现在我想向站点添加非常基本的身份验证(我不需要授权)。由于Flask不支持开箱即用的auth&auth,我想插入一个WSGI中间件来完成这项工作。这个网络应用程序只有大约10个人使用,他们都在Facebook上。所以我想使用Facebook的OAuth接口(interface)。我快速浏览了一遍thewsgi.orglistofWSGIMiddleware并注意到两件事:可用的中间件要么使用起来非常复杂,要么已经过时了。我找到了以下软件包:wsgiauth——过时了。最后一次更新是2006年,我找不到任何在线文档authkit--看

python - Django 1.7 google oauth2 token 验证失败

我正在尝试完成对用于在Django应用程序中访问用户日历的Googletoken进行身份验证的过程。尽管我遵循了在网络上找到的几个指示,但我仍然对我的回调函数(错误请求)有400错误代码响应。views.py#-*-coding:utf-8-*-importosimportargparseimporthttplib2importloggingfromapiclient.discoveryimportbuildfromoauth2clientimporttoolsfromoauth2client.django_ormimportStoragefromoauth2clientimportx

python - 使用 oauth2.0 导入谷歌联系人

使用python和oauth2.0导入google联系人的可能方法有哪些?我们成功获得了凭据,并且我们的应用程序请求访问联系人,但在获得凭据后我找不到发现联系人api的方法。比如:fromapiclient.discoverimportbuildimporthttplib2http=httplib2.Http()#Authorizationservice=build("contacts","v3",http=http)给我们UnknownApiNameOrVersion异常。联系人API似乎不在apiclient支持的API列表中。我正在寻找替代方法。 最佳

python - 通过 Oauth 进行身份验证时 SSL 抛出错误 185090050

我正在尝试使用Google的Oauth连接到Googleadsense,但出现此错误。有任何修复它的线索吗?有人在python中遇到过这样的问题吗?Traceback(mostrecentcalllast):File"get_all_saved_reports.py",line56,inmain(sys.argv)File"get_all_saved_reports.py",line36,inmainservice=sample_utils.initialize_service()File"/home/nish/Programs/python/google-adsense/sample

python - GSpread 导入错误 : No module named oauth2client. service_account

好的,我正在学习“成为一名技术营销人员”类(class),我正在尝试学习如何使用GSpread管理Google电子表格。我遵循了http://gspread.readthedocs.io/en/latest/oauth2.html中的文档.我已按照上面第二个URL中的步骤操作,并使用以下代码运行了一个文档:importgspreadfromoauth2client.service_accountimportServiceAccountCredentialsscope=['https://spreadsheets.google.com/feeds']credentials=Service