Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expanded httpx compatability #195

Closed
wants to merge 5 commits into from
Closed

Conversation

blkmajik
Copy link

@blkmajik blkmajik commented Mar 8, 2022

Sorry, this pull request was originally made against main instead of develop.

httpx 0.18.0 deprecated the httpx.StatusCode class. This fix allows compatibility with 0.17.1 through at least 0.22.0 vs being stuck on 0.17.1.

Description

Change over from httpx.StatusCode to httpx.codes. This is a drop in replacement for how hyperglass uses httpx in this context.

Related Issues

N/A

Motivation and Context

I effectively maintain a custom distribution on top of CentOS/Rocky Linux. My existing httpx version was later that what was required for hyperglass. The easiest fix was to patch hyperglass so it was compatible with httpx >= 0.17.1 instead of locked into 0.17.1.

Tests

I ran pylint and flake8 against _base.py and no errors showed up in relation to my changes. Manual examination of the 0.17.1 source and 0.22.0 source of httpx indicate that StatusCode() from 0.17.1 was just a wrapper around the httpx.codes Enum.

Manual execution of the exception raising code works with a httpx.codes() instance vs a StatuCode() instance.

import httpx
status = httpx.codes(404)
print( f'{status.name.replace("_", " ")}')
NOT FOUND

@blkmajik blkmajik changed the title Develop expanded httpx compatability Mar 9, 2022
@thatmattlove thatmattlove added the fixed-in-next-release Issue has already been fixed in the next release label May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed-in-next-release Issue has already been fixed in the next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants