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

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -