Spaces:
Runtime error
Runtime error
Update app.py
Browse files4 unmodified lines5678891011121314151617181011121314151617181920214 unmodified linesimport urllibimport base64
def download_file(url, local_filename): if url.startswith('http://') or url.startswith('https://'): # add this line try: with requests.get(url, stream=True) as r: r.raise_for_status() with open(local_filename, 'wb') as f: for chunk in r.iter_content(chunk_size=8192): f.write(chunk) return local_filename except requests.exceptions.HTTPError as err: print(f"HTTP error occurred: {err}") # or use logging try: with requests.get(url, stream=True) as r: r.raise_for_status() with open(local_filename, 'wb') as f: for chunk in r.iter_content(chunk_size=8192): f.write(chunk) return local_filename except requests.exceptions.HTTPError as err: print(f"HTTP error occurred: {err}") # or use logging
def download_html_and_files(url):app.py+10-10