Unable to Get Image Using urllib3

Question:

Wondering what I’m missing… urllib3 request isnt returning…

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:

Debug snap

Asked By: 86Meesta2

||

Answers:

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)
Answered By: PLOTFINDER