How to Download Images and PDF files with Python 3 Requests

How to Download Images and PDF files with Python 3 Requests

import re import requests urls = [‘https://www.example.com/image-1.png’,’https://www.example.com/file.pdf’] for i in urls: r = requests.get(i) d = r.headers[‘content-disposition’] fname = re.findall(“filename=(.+)”, d)[0] # send a HTTP request to the server and save # the HTTP response in a response object called r with open(fname,’wb’) as f: f.write(r.content) print(i+”|”+str(fname))  


How to Take Screenshots in Python with Selenium and ChromeDriver

How to Take Screenshots in Python with Selenium and ChromeDriver

Using these steps, you will be able to create screenshots from a list of URLs today using Python 3, Selenium and ChromeDriver.