Spaces:
Runtime error
Runtime error
Update app.py
Browse files4 unmodified lines567891011121314151617181920214 unmodified linesimport urllibimport base64def download_file(url, local_filename):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_filenameexcept requests.exceptions.HTTPError as err:print(f"HTTP error occurred: {err}") # or use loggingdef download_html_and_files(url):4 unmodified lines567891011121314151617181920214 unmodified linesimport urllibimport base64def download_file(url, local_filename):if url.startswith('http://') or url.startswith('https://'): # add this linetry: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_filenameexcept requests.exceptions.HTTPError as err:print(f"HTTP error occurred: {err}") # or use loggingdef download_html_and_files(url):
app.py+10-10