Skip to content

Use httpx for automatic SSL certificate handling - #10

Open
maresb wants to merge 1 commit into
akx:masterfrom
maresb:httpx
Open

Use httpx for automatic SSL certificate handling#10
maresb wants to merge 1 commit into
akx:masterfrom
maresb:httpx

Conversation

@maresb

@maresb maresb commented Jan 24, 2026

Copy link
Copy Markdown

This PR was created with assistance from Claude 4.5 opus-high in Cursor.


Fixes #9

Summary

Replace urllib.request with httpx to fix SSL certificate errors on NixOS.

Changes

  • Replace urllib.request with httpx in github_api.py
  • Update exception handling from urllib.error.HTTPError to httpx.HTTPStatusError in action_updater.py
  • Add httpx>=0.27.0 dependency

Why httpx?

httpx automatically handles SSL certificates:

  • Respects SSL_CERT_FILE if set and valid
  • Falls back to certifi's certificate bundle otherwise

This makes gha-tools work out of the box on NixOS without manual workarounds.

Testing

  • All existing tests pass
  • Manually tested on NixOS with CausalPy repository

@akx akx left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than add httpx as a dependency (not that it's very huge or anything), would it just be enough to add certifi as a dependency and os.environ.setdefault("SSL_CERT_FILE", certifi.where()) like in the workaround suggested in the issue?

@maresb

maresb commented Jan 26, 2026

Copy link
Copy Markdown
Author

I was wondering about that too. I'm honestly pretty confused about best practices with SSL certs. My reasoning was that we could either stick with a low-level implementation and hope to get it right, or we could go high-level so that we inherit a solution from people more expert than me. I went for the latter in this PR, but I think the former is perfectly valid in case you want to minimize dependencies and are sufficiently confident. Feel free to supersede this PR.

Thanks for the fast response!

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.

SSL certificate errors on NixOS

2 participants