繁体   English   中英

urllib2.HTTPError:HTTP错误404:找不到

[英]urllib2.HTTPError: HTTP Error 404: Not Found

使用树莓派运行我的python脚本时出现我的错误消息

Traceback (most recent call last):>Traceback (most recent call last):
  File "test.py", line 6, in (module)
    import appengineauth
  File "/home/pi/Downloads/google_appengine/appengineauth.py", line 30, in (module)
    auth_resp = urllib2.urlopen(auth_req)
  File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 437, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 550, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 475, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 558, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Not Found

我可以访问该网站。 不太清楚实际的问题是什么。

如果您使用的是https://github.com/adafruit/Tweet-a-Watt/blob/master/appengineauth.py (您不会告诉我们从何处获得了appengineauth.py ,这迫使我们猜测) ,及其行

auth_uri = 'https://www.google.com/accounts/ClientLogin'

那么您可能会遇到https://developers.google.com/identity/protocols/AuthForInstalledApps中记录的弃用,我引用:

重要提示:自2012年4月20日起,ClientLogin已正式弃用,现在不再可用。 对ClientLogin的请求将失败,并显示HTTP 404响应。 我们建议您尽快迁移到OAuth 2.0。

即,您将获得的404正是警告告诉您的症状,因为ClientLogin已被删除,比原始弃用警告晚了3.5年。

不确定如何以OAuth 2.0将Raspberry Pi连接到App Engine(或其他需要身份验证的其他Google服务)的最佳方式(因为不再可以选择ClientLogin)。 建议使用http://guy.carpenter.id.au/gaugette/2012/11/06/using-google-oauth2-for-devices/ (在弃用后不久写成,但要避免依赖已经弃用的ClientLogin服务),建议“用于设备的OAuth2”库并总结了如何使用它; 我自己没有尝试过该库(并且我没有Raspberry Pi可以尝试),但是它似乎是您探索的潜在成果之路。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM