I am trying to download a .pdf url from this websitePDFLINKhttps://www.cell.com/heliyon/pdf/S2405-8440(18)33206-7.pdfI am able to view it from my browser, but using the requests with Python won't let me download it.
I tried the following, but I was not able to get it to download properly. It would return a 403 or say that the .pdf is corrupted. But I can view the link fine https://www.cell.com/heliyon/pdf/S2405-8440(18)33206-7.pdfAny ideas?
import requestsdef download_pdf(url): response = requests.get(url) with open('sample.pdf', 'wb') as f: f.write(response.content)if __name__ == "__main__": url = "https://www.cell.com/heliyon/pdf/S2405-8440(18)33206-7.pdf" download_pdf(url)