Add httpx client#13
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces an HTTPX-based client backend for Spoffy, adds factory helpers and tests, and updates CI/dependencies to support the new implementation and newer Python versions.
- Added
AsyncHttpXClientandmake_spotifyfactory tospoffy/io/httpx.py - Extended
Requestinspoffy/sansio.pywith a class‐levelbodyattribute and adjusted initialization - Created new async tests for the HTTPX client and updated CI matrix and dependencies
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/io/test_httpx.py | New async tests for HTTPX client and token logic |
| spoffy/sansio.py | Added body attribute and refactored Request.__init__ |
| spoffy/io/httpx.py | Implementation of AsyncHttpXClient and factory |
| pyproject.toml | Bumped dev deps: snapshottest, flake8, aiohttp, httpx |
| .github/workflows/ci.yml | Upgraded Python versions and GitHub Action versions |
Comments suppressed due to low confidence (2)
tests/io/test_httpx.py:18
- [nitpick] The test function name uses a double underscore (
test__get_artist), which is inconsistent with common test naming conventions. Consider renaming it totest_get_artist.
async def test__get_artist(spotify_cc):
spoffy/sansio.py:23
- The default assignment of
self.bodywas removed in__init__. For non-mapping and non-bytes inputs,self.bodyremainsNoneinstead of the provided value. Consider reintroducingself.body = bodybefore the type checks.
body: Optional[bytes] = None
Comment on lines
+83
to
+84
| AsyncHttpXClient.__doc__ += ClientCommon.__doc__.split("----")[1] # type: ignore | ||
| make_spotify.__doc__ += ClientCommon.__doc__.split("----")[1] # type: ignore |
There was a problem hiding this comment.
Using split("----")[1] assumes the delimiter exists; if it's missing, this will raise an IndexError. Consider using partition("----") or checking the split result length before indexing.
Suggested change
| AsyncHttpXClient.__doc__ += ClientCommon.__doc__.split("----")[1] # type: ignore | |
| make_spotify.__doc__ += ClientCommon.__doc__.split("----")[1] # type: ignore | |
| _, delimiter, after_delimiter = ClientCommon.__doc__.partition("----") | |
| if after_delimiter: | |
| AsyncHttpXClient.__doc__ += after_delimiter # type: ignore | |
| _, delimiter, after_delimiter = ClientCommon.__doc__.partition("----") | |
| if after_delimiter: | |
| make_spotify.__doc__ += after_delimiter # type: ignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.