Skip to content

fix(events): support httpx without NetworkError#861

Draft
Mirochill wants to merge 2 commits into
pyupio:mainfrom
Mirochill:fix-860-httpx-networkerror-fallback
Draft

fix(events): support httpx without NetworkError#861
Mirochill wants to merge 2 commits into
pyupio:mainfrom
Mirochill:fix-860-httpx-networkerror-fallback

Conversation

@Mirochill

@Mirochill Mirochill commented May 21, 2026

Copy link
Copy Markdown

Description

Fixes the import-time failure when Safety is used with httpx versions that no longer expose httpx.NetworkError.

The retry exception tuple now comes from a small compatibility helper that prefers NetworkError when available, then falls back to concrete network error classes (ConnectError, ReadError, WriteError, CloseError) before broader httpx bases. The enrollment transient-error wrapper uses the same helper so exception handling does not reintroduce the same missing-attribute failure.

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor
  • Other (please describe):

Related Issues

Fixes #860

Testing

  • Tests added or updated
  • No tests required

Not run locally.

Checklist

  • Code is well-documented
  • Changelog is updated (if needed)
  • No sensitive information (e.g., keys, credentials) is included in the code
  • All PR feedback is addressed

Additional Notes

Opened as draft so maintainers can decide whether this is the preferred compatibility boundary for httpx 1.0 pre-releases.

@coderabbitai

coderabbitai Bot commented May 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: aba3a244-cac7-4be5-b564-0e2b185ef5a1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

AttributeError: module 'httpx' has no attribute 'NetworkError' with httpx 1.0.dev3 (Python 3.14.5rc1), httpx incompatibility

1 participant