2013-05-25 55 views
0

試圖檢索博客,但返回錯誤訪問博客:故障使用網址抓取

[13-05-25 07:45:42:500 PDT] Exception: Request failed for 
https://www.googleapis.com/blogger/v3/users/self/blogs returned code 
404. Server response: <!DOCTYPE html> <html lang=en> <meta charset=utf-8> <meta name=viewport content="initial-scale=1, 
minimum-scale=1, width=device-width"> <title>Error 404 (Not 
Found)!!1</title> <style> 
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% 
auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > 
body{background:url(//www.google.com/images/errors/robot.png) 100% 5px 
no-repeat;padding-right:205px}p{margin:11px 0 
22px;overflow:hidden}ins{color:#777;text-decoration:none}a 
img{border:0}@media screen and 
(max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}} 
</style> <a href=//www.google.com/><img 
src=//www.google.com/images/errors/logo_sm.gif alt=Google></a> 
<p><b>404.</b> <ins>That’s an error.</ins> <p>The requested URL 
<code>/blogger/v3/users/self/blogs</code> was not found on this 
server. <ins>That’s all we know.</ins> 

這裏我的代碼:

function retrieveBlog(){ 
    var access_token ="my acces token"; 
    var options = 
     { 
     "headers" : { " Authorization " : access_token} 
     }; 

    try { 

    var result = UrlFetchApp.fetch("https://www.googleapis.com/blogger/v3/users/self/blogs",options); 

    Logger.log(result); 

    } catch (e) { 
    Logger.log(e); 
    } 
} 

你能告訴我什麼亞姆錯????

回答

0

只做了一個快速測試,發現你的頭部有一個額外的空間。

試試這個行,而不是 -

"headers" : { "Authorization" : access_token}

工作的罰款我。

+0

thx @Arun Nagarajan它幫助我...再次thx! –