I wish download the PDF from https://hcraj.nic.in/cishcraj-jdp/JudgementFilters/ .
Fill a data range say - 23-07-2020 to 24-07-2020 Select Category, say - Civil
Then just submit the Form.
We get an option to download the PDF. When trying manually, it works fine.
But when I try to do the same using Python Scrapy, it still downloads the PDF, but it is of no use as the PDF downloaded is not readable.
An example link of PDF is - https://hcraj.nic.in/cishcraj-jdp/pdfjs-dist/web/viewer.php?file=https://hcraj.nic.in/cishcraj-jdp/storefiles/createordjud/206800053982020_1.pdf
Opening it in the browser also gives a 404 Error. But when i do it manually through the browser, it get downloaded easily.
My Code to download PDF is :
with open(os.path.join(path2,pdf_name), 'wb') as file:
file.write(response.body)
Can anyone please help ?