From 6184601badcbb3de31a3f69c45520aeb87bd5248 Mon Sep 17 00:00:00 2001 From: Azalea Date: Fri, 16 Sep 2022 01:28:14 -0400 Subject: [PATCH] [-] Remove requests dependency --- scripts/bin/update-ssh-keys.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/bin/update-ssh-keys.py b/scripts/bin/update-ssh-keys.py index fa5a61f..3e5051c 100755 --- a/scripts/bin/update-ssh-keys.py +++ b/scripts/bin/update-ssh-keys.py @@ -4,6 +4,8 @@ import importlib import subprocess import sys from pathlib import Path +from urllib.request import Request, urlopen + from color_utils import printc @@ -15,15 +17,15 @@ def import_or_install(module: str, package: str | None = None): return importlib.import_module(module) -requests = import_or_install('requests') - - GITHUB_USERS = ['hykilpikonna'] KEYS_PATH = Path.home() / '.ssh' / 'authorized_keys' def fetch_keys(user: str) -> set[str]: - resp = requests.get(f"https://github.com/{user}.keys").text + req = Request(f"https://github.com/{user}.keys") + with urlopen(req) as response: + assert response.status == 200 + resp = response.read().decode() return {f"{l} {user}@github" for l in resp.strip().splitlines()}