Skip to main content

actually, ditch the http snippet

ID
5c4115a
date
2026-03-30 07:42:36+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
f0264c4
message
actually, ditch the http snippet
changed files
2 files, 33 deletions

Changed files

create_snippets.py (8497) → create_snippets.py (8467)

diff --git a/create_snippets.py b/create_snippets.py
index 029067b..a48dbee 100755
--- a/create_snippets.py
+++ b/create_snippets.py
@@ -260,7 +260,6 @@ SNIPPETS = {
     "@param": "@pytest.mark.parametrize({cursor})",
 
     "!flapi": read("flapi.py"),
-    "!http": read("http.py"),
 
     "py!aws": read("get_boto3_session.py"),
     "py!dy": read("list_dynamodb_rows.py"),

expansions/http.py (905) → expansions/http.py (0)

diff --git a/expansions/http.py b/expansions/http.py
deleted file mode 100644
index 5e26e56..0000000
--- a/expansions/http.py
+++ /dev/null
@@ -1,32 +0,0 @@
-"""
-A basic wrapper for making HTTP requests with the standard library.
-"""
-
-import ssl
-import urllib.parse
-import urllib.request
-
-import certifi
-
-
-def http_get(url: str, params: dict[str, str] | None = None, headers: dict[str, str] | None = None) -> tuple[bytes, dict[str, str]]:
-    """
-    Makes an HTTP GET request to the given URL, and returns the body
-    and headers of the response.
-    """
-    ssl_context = ssl.create_default_context(cafile=certifi.where())
-    
-    if params:
-        params_str = urllib.parse.urlencode(params)
-        url = url + "?" + params_str
-    
-    ssl_context = ssl.create_default_context(cafile=certifi.where())
-    
-    req = urllib.request.Request(url)
-    
-    if headers:
-        for name, value in headers.items():
-            req.add_header(name, value)
-
-    with urllib.request.urlopen(req, context=ssl_context) as resp:
-    	return resp.read(), resp.headers