Every morning, Multnomah County posts whether or not it's OK to light a fire in your fireplace. Instead of heading to the site everyday, I'm trying to automate the process with an app that grabs an image from the server that shows the status.
Right now, the script successfully gives me the link to the image, which (today) is https://multco.us/sites/default/files/styles/small/public/Copy%20of%20Advisory%20-%20Green.jpg
.
I've been searching and searching and can't find a way to actually download the image or grab it so I can send it to myself via a Twilio SMS app.
Here's my script:
from bs4 import BeautifulSoup
import requests
source = requests.get(
'https://multco.us/health/staying-healthy/winter-wood-burning-restrictions').text
soup = BeautifulSoup(source, 'lxml')
img = soup.find('div', class_='field-body').h2.img.attrs['src']
img_url_split = img.split('?')
img_url = img_url_split[0]
print(img_url)