[英]Unable to Get Image Using urllib3
Wondering what I'm missing... urllib3 request isnt returning...想知道我错过了什么...... urllib3 请求没有返回......
import urllib3
url = "https://www.mouser.com/images/adi/sm/ITP_ADI_SOT-23-6_05-08-1636_t.jpg"
http = urllib3.PoolManager()
response = http.request('GET', url)
print(response.status)
Stepped through it in debug and this is what I see:在调试中逐步执行它,这就是我所看到的:
You need to specify the headers:您需要指定标头:
import urllib3
url = "https://www.mouser.com/images/adi/sm/ITP_ADI_SOT-23-6_05-08-1636_t.jpg"
http = urllib3.PoolManager(headers={'User-Agent': 'Mozilla/5.0'})
response = http.request('GET', url)
print(response.status)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.