I want to download pdf files using python code from
https://edemocracy.coventry.gov.uk/ieListDocuments.aspx?CId=124&MId=12817&Ver=4.
But, the files are not downloading.
Can anyone help?
Regards, Pradeep
I want to download pdf files using python code from
https://edemocracy.coventry.gov.uk/ieListDocuments.aspx?CId=124&MId=12817&Ver=4.
But, the files are not downloading.
Can anyone help?
Regards, Pradeep
import requests
from bs4 import BeautifulSoup
from pathlib import Path
import requests
link = "https://edemocracy.coventry.gov.uk/ieListDocuments.aspx?CId=124&MId=12817&Ver=4"
page = requests.get(link)
soup = BeautifulSoup(page.content, "html.parser")
all_pdf = []
for i in soup.find_all("a"):
try:
if ".pdf" in i['href']:
all_pdf.append("https://edemocracy.coventry.gov.uk/" + i['href'])
except:
pass
na = 0
for url in all_pdf:
na += 1
filename = Path(str(na) + '.pdf')
response = requests.get(url)
filename.write_bytes(response.content)
Hope This will help