requests.exceptions.MissingSchema


requests.exceptions.MissingSchema: Invalid URL '//p9.pstatp.com/list/pgc-image/1538380201743a84869e0b6': No schema supplied. Perhaps you meant http:////p9.pstatp.com/list/pgc-image/1538380201743a84869e0b6?

碰到這個問題的地方來源:爬取今日頭條圖片

報錯寫法:

response = requests.get(item.get("image"))

 並且注意報錯的地方,說我們搜索的可能是http:////p9.pstatp.com/list/pgc-image/1538380201743a84869e0b6?,但這樣去搜索欄里是搜索不到內容的

正確寫法:

response = requests.get("http:" + item.get("image"))

因此在在將請求頭的時候要注意一點。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM