@st.cache(persist=True)
def read_file_from_url(url):
try:
return urllib.request.urlopen(url).read()
except urllib.error.URLError:
st.error("Unable to load file from %s. ""Is the internet connected?" % url)
except Exception as e:
st.exception(e)
After Change
@st.cache(persist=True)
def read_file_from_url(url):
try:
return requests.get(url).content
except requests.exceptions.RequestException:
st.error("Unable to load file from %s. ""Is the internet connected?" % url)
except Exception as e:
st.exception(e)