Skip to content

Replace httpx with httpx2 - #717

Merged
jodal merged 1 commit into
mainfrom
httpx2
Oct 24, 2026
Merged

jodal merged 1 commit into
mainfrom
httpx2

Conversation

@jodal

@jodal jodal commented Oct 24, 2026

Copy link
Copy Markdown
Owner

🤖 Summary

This PR replaces httpx with httpx2. Pydantic maintains httpx2 as the continuation of httpx. In httpx2 2.0, the only API change is the package rename.

-import httpx
+import httpx2

-response = httpx.get(url, headers=headers, follow_redirects=True)
+response = httpx2.get(url, headers=headers, follow_redirects=True)

-except (httpx.HTTPError, httpx.InvalidURL, OSError) as error:
+except (httpx2.HTTPError, httpx2.InvalidURL, OSError) as error:

Behavior changes from httpx 0.28.1 to httpx2 2.16.0:

  • SSL verification uses the operating system's trust store (truststore), not certifi.
  • The default User-Agent is python-httpx2/<version>. Crawlers that set their own User-Agent are not affected.

Evidence

In the Docker image built from this branch:

httpx2.get("https://www.gocomics.com/")    -> 200, User-Agent: python-httpx2/2.16.0
httpx2.get("https://expired.badssl.com/")  -> ConnectError

The system trust store in the slim image accepts valid certificates and rejects invalid ones.

Merge Danger

Door: two-way

Blast Radius: Crawlers

All crawlers and image downloads use this HTTP client. A site that checks the User-Agent can respond differently to the new default value.

@codecov

codecov Bot commented Oct 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.92%. Comparing base (b3c1057) to head (e262aac).

Files with missing lines Patch % Lines
src/comics/aggregator/crawler.py 25.00% 3 Missing ⚠️
src/comics/aggregator/downloader.py 33.33% 2 Missing ⚠️
src/comics/aggregator/lxmlparser.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #717   +/-   ##
=======================================
  Coverage   68.92%   68.92%           
=======================================
  Files          46       46           
  Lines        2066     2066           
=======================================
  Hits         1424     1424           
  Misses        642      642           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jodal
jodal merged commit bad00ba into main Oct 24, 2026
10 of 11 checks passed
@jodal
jodal deleted the httpx2 branch October 24, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant