python - 我应该如何解决 appspot 备份失败的问题?

标签 python google-app-engine

我正在尝试进行备份,但失败了:

2011-10-01 09:22:43.706 /remote_api 302 5ms 0cpu_ms 0kb

213.89.134.0 - - [01/Oct/2011:05:22:43 -0700] "GET /remote_api HTTP/1.1" 302 0 - - "montaoproject.appspot.com" ms=6 cpu_ms=0 api_cpu_ms=0 cpm_usd=0.000032

$ python ./appcfg.py download_data --application=montaoproject --url=http://montaoproject.appspot.com/remote_api --filename=montao.data
Downloading data records.
[INFO    ] Logging to bulkloader-log-20111001.122234
[INFO    ] Throttling transfers:
[INFO    ] Bandwidth: 250000 bytes/second
[INFO    ] HTTP connections: 8/second
[INFO    ] Entities inserted/fetched/modified: 20/second
[INFO    ] Batch Size: 10
[INFO    ] Opening database: bulkloader-progress-20111001.122234.sql3
[INFO    ] Opening database: bulkloader-results-20111001.122234.sql3
[INFO    ] Connecting to montaoproject.appspot.com/remote_api
Please enter login credentials for montaoproject.appspot.com
Email: niklasro
Password for niklasro: 
[INFO    ] Authentication Failed

app.yaml:

- url: /remote_api
  script: remote_api.py

remote_api.py:

from google.appengine.ext.remote_api import handler
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app

import re


MY_SECRET_KEY = 'thetopsecret'


cookie_re = re.compile('^"([^:]+):.*"$')


class ApiCallHandler(handler.ApiCallHandler):
    def CheckIsAdmin(self):
        login_cookie = self.request.cookies.get('dev_appserver_login', '')
        match = cookie_re.search(login_cookie)
        if (match and match.group(1) == MY_SECRET_KEY
            and 'X-appcfg-api-version' in self.request.headers):
            return True
        else:
            self.redirect('/_ah/login')
            return False


application = webapp.WSGIApplication([('.*', ApiCallHandler)])


def main():
    run_wsgi_app(application)


if __name__ == '__main__':
    main()

更新 服务器状态为302,未到达remote_api.py中的方法:

2011-11-08 09:02:40.214 /remote_api?rtok=935015419683 302 12ms 0kb

213.89.134.0 - - [08/Nov/2011:03:02:40 -0800] "GET /remote_api?rtok=935015419683 HTTP/1.1" 302 0 - - "montaoproject.appspot.com" ms=13 cpu_ms=0 api_cpu_ms=0 cpm_usd=0.000026

最佳答案

当使用这种方法让远程 API 使用开放 ID(来自 http://blog.notdot.net/2010/06/Using-remote-api-with-OpenID-authentication )时,我认为您需要在出现提示时将 key (即“thetopsecret”)指定为电子邮件(然后在出现提示时按 Enter 键)提示输入密码)。

关于python - 我应该如何解决 appspot 备份失败的问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7620200/

相关文章:

java - 我可以在 Java 中扩展 App Engine 标准错误 JSON 吗?

java - 确保在 GAE/J 中每个用户请求处理序列化

python - 如何获取scrapyrt的POST元数据?

Python:试图从 Pandas 的DataFrame中创建一个矩阵

python - 如何删除空格并在 python 打印函数中包含 '{'

java - Google App Engine Query Execute 只接受 3 个参数

google-app-engine - 是否可以向 API Explorer 中的 Cloud Endpoint 字段添加描述?

python - 使用 ElementTree 时出现未定义实体错误

python - Django 将属性添加到 SelectMultiple <option> 标签

Android 到服务器上的 App Engine GRPC 空指针