Skip to content

Commit 3462250

Browse files
committed
chore: Update urllib to requests for downloading data
1 parent 1b57a04 commit 3462250

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

examples/regression/3-scientific-articles/plot_kim2020_simulations.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@
3030
"""
3131
from __future__ import annotations
3232

33-
import ssl
33+
import requests
3434
from io import BytesIO
3535
from typing import Any, Optional, Tuple
36-
from urllib.request import urlopen
3736
from zipfile import ZipFile
3837

3938
import matplotlib.pyplot as plt
@@ -69,9 +68,8 @@ def get_X_y() -> Tuple[NDArray, NDArray]:
6968
zip_folder = "BlogFeedback.zip"
7069
csv_file = "blogData_train.csv"
7170
url = website + page + folder + zip_folder
72-
ssl._create_default_https_context = ssl._create_unverified_context
73-
resp = urlopen(url)
74-
zipfile = ZipFile(BytesIO(resp.read()))
71+
response = requests.get(url)
72+
zipfile = ZipFile(BytesIO(response.content))
7573
df = pd.read_csv(zipfile.open(csv_file)).to_numpy()
7674
X = df[:, :-1]
7775
y = np.log(1 + df[:, -1])

0 commit comments

Comments
 (0)