Skip to content

Add httpx client#13

Merged
steinitzu merged 8 commits into
masterfrom
httpx-client
Jun 20, 2025
Merged

Add httpx client#13
steinitzu merged 8 commits into
masterfrom
httpx-client

Conversation

@steinitzu

Copy link
Copy Markdown
Owner

No description provided.

@steinitzu
steinitzu requested a review from Copilot June 20, 2025 15:17

This comment was marked as outdated.

@steinitzu
steinitzu requested a review from Copilot June 20, 2025 15:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 AsyncHttpXClient and make_spotify factory to spoffy/io/httpx.py
  • Extended Request in spoffy/sansio.py with a class‐level body attribute 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 to test_get_artist.
async def test__get_artist(spotify_cc):

spoffy/sansio.py:23

  • The default assignment of self.body was removed in __init__. For non-mapping and non-bytes inputs, self.body remains None instead of the provided value. Consider reintroducing self.body = body before the type checks.
    body: Optional[bytes] = None

Comment thread spoffy/io/httpx.py
Comment on lines +83 to +84
AsyncHttpXClient.__doc__ += ClientCommon.__doc__.split("----")[1] # type: ignore
make_spotify.__doc__ += ClientCommon.__doc__.split("----")[1] # type: ignore

Copilot AI Jun 20, 2025

Copy link

Choose a reason for hiding this comment

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

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

Copilot uses AI. Check for mistakes.
@steinitzu
steinitzu merged commit 4f85e91 into master Jun 20, 2025
5 checks passed
@steinitzu
steinitzu deleted the httpx-client branch June 20, 2025 16:00
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.

2 participants