[英]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.