Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit cc2e7d0

Browse files
committed
use requests not urlopen
1 parent 2a1226d commit cc2e7d0

File tree

1 file changed

+3
-3
lines changed
  • nowcasting_dataset/data_sources/gsp

1 file changed

+3
-3
lines changed

nowcasting_dataset/data_sources/gsp/eso.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515

1616
import logging
1717
import os
18-
from urllib.request import urlopen
1918

2019
import geopandas as gpd
2120
import pandas as pd
21+
import requests
2222

2323
from nowcasting_dataset.data_sources.gsp.pvlive import get_list_of_gsp_ids
2424
from nowcasting_dataset.geospatial import osgb_to_lat_lon
@@ -142,8 +142,8 @@ def get_gsp_shape_from_eso(
142142
"resource/08534dae-5408-4e31-8639-b579c8f1c50b/download/gsp_regions_20220314.geojson"
143143
)
144144

145-
with urlopen(url) as response:
146-
shape_gpd = gpd.read_file(response)
145+
with requests.get(url) as response:
146+
shape_gpd = gpd.read_file(response.text)
147147

148148
# calculate the centroid before using - to_crs
149149
shape_gpd["centroid_x"] = shape_gpd["geometry"].centroid.x

0 commit comments

Comments
 (0)