相关疑难解决方法(0)

gdata-python-api +具有简单身份验证的分析

我正在努力将使用Google gdata API客户端+用户/通过身份验证的Python脚本转换为更适合生产的东西(API密钥).我对他们关于身份验证的文档的混乱状态感到非常沮丧.我承认自己并没有很好地掌握OAuth2,但对我的使用案例来说似乎更为复杂,即:每24小时点击一次谷歌分析,就可以获得我们网站上最受欢迎的X文章.

在这种情况下,我们不会处理修改某人的个人数据,并且所有活动都集中在一个帐户上.对于这么简单的事情来说,OAuth2似乎不值得复杂.

我在Google API控制台(https://code.google.com/apis/console/)上看到,我在那里注册并注意到有一个"简单API访问"部分,其中一个键位于"客户端ID"下方网络应用程序"(似乎是OAuth2).还有Google域名更新页面,https://www.google.com/accounts/UpdateDomain,但似乎与OAuth相关.

有没有办法使用这个简单的API访问密钥(而不是OAuth)来检索Python gdata客户端的分析数据,如果是这样,有没有人有任何身份验证示例?我已经对数据检索工作进行了一次身份验证,但我使用的是用户/传递方法,这种方法不适合生产.

python api oauth

10
推荐指数
1
解决办法
2642
查看次数

使用 Python apiclient 忙时调用 Google Calendar API v3 时出现 TypeError

我想获取两个给定日期之间我的 Google 日历的所有空闲/忙碌事件。我正在关注freebusy 对象的文档

\n\n

基本上,我有一个index.html,其表单允许选择两个日期。我将这些日期发送到我的应用程序(Python Google AppEngine 支持)。

\n\n

这是经过简化的代码,使其更具可读性:

\n\n
CLIENT_SECRETS = os.path.join(os.path.dirname(__file__), \'client_secrets.json\')\n\ndecorator = oauth2decorator_from_clientsecrets(\n    CLIENT_SECRETS,\n    scope=\'https://www.googleapis.com/auth/calendar\',\n    message=MISSING_CLIENT_SECRETS_MESSAGE)\n\nservice = build(\'calendar\', \'v3\')\n\nclass MainPage(webapp2.RequestHandler):\n  @decorator.oauth_required\n  def get(self):\n    # index.html contains a form that calls my_form\n    template = jinja_enviroment.get_template("index.html")\n    self.response.out.write(template.render())\n\nclass MyRequestHandler(webapp2.RequestHandler):\n  @decorator.oauth_aware\n  def post(self):\n    if decorator.has_credentials():\n\n      # time_min and time_max are fetched from form, and processed to make them\n      # rfc3339 compliant\n      time_min = some_process(self.request.get(time_min))\n      time_max = some_process(self.request.get(time_max))\n\n      #\xc2\xa0Construct freebusy query request\'s body\n      freebusy_query = {\n        "timeMin" : …
Run Code Online (Sandbox Code Playgroud)

python google-app-engine google-calendar-api oauth-2.0

3
推荐指数
1
解决办法
1861
查看次数