not getting a urllib response on some urls that opens regularly in the webbrowser

Viewed 124

I am having an issue with urllib on python3 that I dont know how to solve. this is my code :

import urllib.request
       hdr = { 'User-Agent' : 'super happy flair bot by /u/spladug' }
       req = urllib.request.Request(url,headers=hdr)
       data = urllib.request.urlopen(req,timeout=10).read()
       return data

Stuff I tried:

  1. Changing user agent
  2. Adding and removing timeouts
  3. curl these sites

but still there are some sites(that ends with image file extension like http://xxx.xxx/aaa.png or .jpg) that I just can't get a response, and if I am setting a timeout I am getting TimeOutError. but if i open the same site in the chrome everything working fine. Does someone have any solution or faced the issue?

site example - https://sgfm.elcorteingles.es/SGFM/dctm/MEDIA03/202006/24/00117731276964____5__210x210.jpg

1 Answers
Related