Skip to content

Latest commit

 

History

History
20 lines (13 loc) · 490 Bytes

20240531100650.md

File metadata and controls

20 lines (13 loc) · 490 Bytes

using requests head

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