Skip to main content

urls: don’t import certifi unless explicitly required

ID
412a0b0
date
2026-05-05 18:48:15+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
9e34ade
message
urls: don't import certifi unless explicitly required

In particular `chives.static_site_tests` imports `chives.urls`, but it
doesn't list certifi as a dependency, nor does it need it.
changed files
1 file, 2 additions, 2 deletions

Changed files

src/chives/urls.py (4635) → src/chives/urls.py (4639)

diff --git a/src/chives/urls.py b/src/chives/urls.py
index 17596aa..6559fbb 100644
--- a/src/chives/urls.py
+++ b/src/chives/urls.py
@@ -10,8 +10,6 @@ from urllib.error import HTTPError
 from urllib.parse import SplitResult, parse_qs, urlencode, urlsplit
 import urllib.request
 
-import certifi
-
 from chives.fetch import fetch_url
 
 
@@ -53,6 +51,8 @@ def is_mastodon_host(hostname: str) -> bool:
     """
     Check if a hostname is a Mastodon server.
     """
+    import certifi
+
     if hostname in {
         "hachyderm.io",
         "iconfactory.world",