简体   繁体   English

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

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

My Error Message when running my python scripts using a raspberry pi 使用树莓派运行我的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

I'm able to access the website. 我可以访问该网站。 Not too sure what is the actual problem. 不太清楚实际的问题是什么。

If you're using https://github.com/adafruit/Tweet-a-Watt/blob/master/appengineauth.py (you don't tell us where you got your appengineauth.py from, thus forcing us to guess), and its line 如果您使用的是https://github.com/adafruit/Tweet-a-Watt/blob/master/appengineauth.py (您不会告诉我们从何处获得了appengineauth.py ,这迫使我们猜测) ,及其行

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

then you're likely running into the deprecation documented at https://developers.google.com/identity/protocols/AuthForInstalledApps , and I quote: 那么您可能会遇到https://developers.google.com/identity/protocols/AuthForInstalledApps中记录的弃用,我引用:

Important: ClientLogin has been officially deprecated since April 20, 2012 and is now no longer available. 重要提示:自2012年4月20日起,ClientLogin已正式弃用,现在不再可用。 Requests to ClientLogin will fail with a HTTP 404 response. 对ClientLogin的请求将失败,并显示HTTP 404响应。 We encourage you to migrate to OAuth 2.0 as soon as possible. 我们建议您尽快迁移到OAuth 2.0。

Ie, the 404 you're getting would then be exactly the symptom the warning tells you about, now that ClientLogin has been removed, more than 3.5 years after the original deprecation warning. 即,您将获得的404正是警告告诉您的症状,因为ClientLogin已被删除,比原始弃用警告晚了3.5年。

Not sure how best to connect your Raspberry Pi to App Engine (or any other Google service requiring authentication) with OAuth 2.0 (since ClientLogin is not an option any more). 不确定如何以OAuth 2.0将Raspberry Pi连接到App Engine(或其他需要身份验证的其他Google服务)的最佳方式(因为不再可以选择ClientLogin)。 http://guy.carpenter.id.au/gaugette/2012/11/06/using-google-oauth2-for-devices/ (written shortly after the deprecation but smartly avoiding reliance on the already-deprecated ClientLogin service) recommends an "OAuth2 for Devices" library and summarizes how to use it; 建议使用http://guy.carpenter.id.au/gaugette/2012/11/06/using-google-oauth2-for-devices/ (在弃用后不久写成,但要避免依赖已经弃用的ClientLogin服务),建议“用于设备的OAuth2”库并总结了如何使用它; I haven't tried that library myself (and I don't have a Raspberry Pi to try it on) but it does seem like a potentially fruitful avenue for you to explore. 我自己没有尝试过该库(并且我没有Raspberry Pi可以尝试),但是它似乎是您探索的潜在成果之路。

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

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