小编dMc*_*ish的帖子

从Google App Engine调用Reddit api时出现错误429

我已经在Google App Engine上运行了一个多月的cron工作,没有任何问题.这项工作做了很多事情,一个是它使用urllib2来调用从Reddit以及其他一些站点检索json响应.大约两周前,我开始在调用Reddit时看到错误,但在调用其他站点时没有错误.我收到的错误是HTTP错误429.

我尝试在Google App Engine之外执行相同的代码并且没有任何问题.我尝试使用urlFetch,但收到相同的错误.

使用应用程序引擎的交互式shell时,您可以看到错误,其中包含以下代码.

import urllib2
data = urllib2.urlopen('http://www.reddit.com/r/Music/.json', timeout=60)
Run Code Online (Sandbox Code Playgroud)

编辑:不确定为什么它总是失败对​​我而不是别人.这是我收到的错误:

>>> import urllib2
>>> data = urllib2.urlopen('http://www.reddit.com/r/Music/.json', timeout=60)
Traceback (most recent call last):
  File "/base/data/home/apps/s~shell-27/1.356011914885973647/shell.py", line 267, in get
    exec compiled in statement_module.__dict__
  File "<string>", line 1, in <module>
  File "/base/python27_runtime/python27_dist/lib/python2.7/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/base/python27_runtime/python27_dist/lib/python2.7/urllib2.py", line 400, in open
    response = meth(req, response)
  File "/base/python27_runtime/python27_dist/lib/python2.7/urllib2.py", line 513, in http_response
    'http', request, response, code, msg, hdrs)
  File "/base/python27_runtime/python27_dist/lib/python2.7/urllib2.py", line …
Run Code Online (Sandbox Code Playgroud)

python google-app-engine reddit

8
推荐指数
1
解决办法
8016
查看次数

标签 统计

google-app-engine ×1

python ×1

reddit ×1