c74227ac25b35b06f13216bdbf902cb7e636ee42,examples/reference.py,,read_file_from_url,#Any#,201

Before Change


@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)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 5

Non-data size: 7

Instances


Project Name: streamlit/streamlit
Commit Name: c74227ac25b35b06f13216bdbf902cb7e636ee42
Time: 2019-09-13
Author: tconkling@gmail.com
File Name: examples/reference.py
Class Name:
Method Name: read_file_from_url


Project Name: streamlit/streamlit
Commit Name: c74227ac25b35b06f13216bdbf902cb7e636ee42
Time: 2019-09-13
Author: tconkling@gmail.com
File Name: lib/streamlit/util.py
Class Name:
Method Name: _make_blocking_http_get


Project Name: streamlit/streamlit
Commit Name: c74227ac25b35b06f13216bdbf902cb7e636ee42
Time: 2019-09-13
Author: tconkling@gmail.com
File Name: docs/api-examples-source/charts.image.py
Class Name:
Method Name: read_file_from_url


Project Name: streamlit/streamlit
Commit Name: c74227ac25b35b06f13216bdbf902cb7e636ee42
Time: 2019-09-13
Author: tconkling@gmail.com
File Name: docs/api-examples-source/charts.video.py
Class Name:
Method Name: read_file_from_url


Project Name: streamlit/streamlit
Commit Name: c74227ac25b35b06f13216bdbf902cb7e636ee42
Time: 2019-09-13
Author: tconkling@gmail.com
File Name: docs/api-examples-source/charts.audio.py
Class Name:
Method Name: read_file_from_url