Download pdf from https://xxxx/ShowDocument?id=yyyy in Python -
i'm new web scraping, pretty familiar python. i'm trying find way use python download pdf (or 1 it) @ link:
https://www.gilbertaz.gov/home/showdocument?id=21298
i've seen code online (download pdf using urllib?) how download file known format such http://www.example.com/mypdf.pdf example.
however, whole showdocument?id=xxxxx format throwing me loop. i'm guessing format pointer file structure on website files stored, don't know how access/download these files. has else seen , know how deal it?
import requests url = 'https://www.gilbertaz.gov/home/showdocument?id=21298' r = requests.get(url, stream=true) open('/tmp/metadata.pdf', 'wb') fd: chunk in r.iter_content(chunk_size): fd.write(chunk) try , see if works. otherwise, let me know.
Comments
Post a Comment