2013-05-14 72 views
0

enter image description here圖像在通過wget下載時被破壞。我哪裏錯了?

當我嘗試使用wget下載時,此圖像受損。我完全不確定我哪裏出錯了。這是我的代碼:

command = 'wget ' + '-U "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.17 (KHTML, like Gecko) Ubuntu/11.04 Chromium/11.0.654.0 Chrome/11.0.654.0 Safari/534.17"' + image + ' -O ' + path 

       ssh.exec_command(command) 
       command = 'mogrify -auto-orient ' + path 
       ssh.exec_command(command) 
+0

圖像請添加URL你在嘗試。 – user1669710 2013-05-14 15:12:38

+0

當你沒有* python下載時,它會損壞嗎? – 2013-05-14 15:25:03

回答

0

先驗你正在做正確的用-U和瀏覽器的代理字符串。

這個工作對提問者here

wget -U "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.17 
(KHTML, like Gecko) Ubuntu/11.04 Chromium/11.0.654.0 Chrome/11.0.654.0 
Safari/534.17" http://static.die.net/earth/mercator/1600.jpg 

所以,你可以確保你在你的粘貼代碼有作爲+ image + ' -O ' + path實際上是一個URL形式http://static.die.net/earth/mercator/1600.jpg