try: response = requests.get(url, stream=True) response.raise_for_status() # Raise an exception for HTTP errors