Need to check if a resource exists? 💡
Use requests.head() instead of requests.get() for a faster response! 🏃
It only fetches the headers, saving time and bandwidth. 🕒
I used it the other day to quickly check if a transcript was added to a podcast episode. 😎
import requests
url = "https://www.buzzsprout.com/1501156/15129871/transcript"
response = requests.head(url)
if response.status_code == 200:
print("Transcript exists!")
#requests