Web scrapping for downloading images from NHTSA website (CIREN crash cases)
I am trying to download some images from NHTSA Crash Viewer (CIREN cases). An example of the case https://crashviewer.nhtsa.dot.gov/nass-CIREN/CaseForm.aspx?xsl=main.xsl&CaseID=99817 If I try to download a Front crash image then there is no file downloaded. I am using beautifulsoup4 and requests libraries. This code works for other websites.
The link of images are in the following format: https://crashviewer.nhtsa.dot.gov/nass-CIREN/GetBinary.aspx?Image&ImageID=555004572&CaseID=555003071&Version=0
I have also tried the previous answers from SO but none solution works, Error obtained: No response form server
Code used for web scrapping
from bs4 import * import requests as rq import os r2 = rq.get("https://crashviewer.nhtsa.dot.gov/nass-CIREN/GetBinary.aspx?Image&ImageID=555004572&CaseID=555003071&Version=0") soup2 = BeautifulSoup(r2.text, "html.parser") links =  x = soup2.select('img[src^="https://crashviewer.nhtsa.dot.gov"]') for img in x: links.append(img['src']) os.mkdir('ciren_photos') i=1 for index, img_link in enumerate(links): if i<=200: img_data = rq.get(img_link).content with open("ciren_photos\\"+str(index+1)+'.jpg', 'wb+') as f: f.write(img_data) i += 1 else: f.close() break