Skip to content

Commit 601ca8c

Browse files
committed
got rid of urllib
1 parent 721a013 commit 601ca8c

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/gardenlinux/github/__main__.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import argparse
22
import gzip
3+
import io
34
import json
45
import os
56
import re
67
import shutil
78
import sys
89
import textwrap
9-
import urllib.request
1010
from pathlib import Path
1111

1212
import requests
@@ -673,13 +673,17 @@ def compare_apt_repo_versions(previous_version, current_version):
673673

674674

675675
def _get_package_list(gardenlinux_version):
676-
(path, headers) = urllib.request.urlretrieve(
677-
f"https://packages.gardenlinux.io/gardenlinux/dists/{gardenlinux_version}/main/binary-amd64/Packages.gz"
678-
)
679-
with gzip.open(path, "rt") as f:
680-
d = DebsrcFile()
681-
d.read(f)
682-
return d
676+
url = f"https://packages.gardenlinux.io/gardenlinux/dists/{gardenlinux_version}/main/binary-amd64/Packages.gz"
677+
response = requests.get(url, timeout=REQUESTS_TIMEOUTS)
678+
response.raise_for_status()
679+
680+
d = DebsrcFile()
681+
682+
with io.BytesIO(response.content) as buf:
683+
with gzip.open(buf, "rt") as f:
684+
d.read(f)
685+
686+
return d
683687

684688

685689
def create_github_release_notes(gardenlinux_version, commitish):

0 commit comments

Comments
 (0)