Skip to content

Conversation

@techouse
Copy link

@techouse techouse commented Aug 29, 2025

Summary

This pull request is a followup on #3642 and adds comprehensive documentation for advanced query parameter handling in HTTPX. The new guide explains how to use the third-party qs_codec package to encode and decode complex query strings, including nested dictionaries, lists, and duplicate keys. It also provides practical examples and a custom transport for merging query parameters.

New advanced query parameter documentation:

  • Added a detailed guide (docs/advanced/query_parameters.md) on handling complex/nested query parameters in HTTPX using the qs_codec package, including encoding/decoding, list formats, space encoding modes, and merging strategies.
  • Included code examples demonstrating usage of qs_codec for encoding nested data, handling repeated keys, and customizing percent-encoding.

Practical usage and integration:

  • Provided a helper function and a custom HTTPX transport (SmartQueryStrings) to automatically merge additional query parameters with existing ones, showcasing real-world integration patterns.
  • Explained real-world usage with the Strapi CMS and referenced the strapi-client package for further implementation details.

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

@techouse techouse changed the title docs: add advanced query parameters guide with qs_codec usage docs: add advanced query parameters guide with qs_codec usage Aug 29, 2025
@karpetrosyan
Copy link
Contributor

karpetrosyan commented Sep 9, 2025

I would recommend to isolate it in a standalone repo, instead of documenting bunch of custom code. So a user can just import that transport and add it to his chain of transports.
httpx-qs for example

@techouse
Copy link
Author

techouse commented Sep 9, 2025

httpx-qs

@karpetrosyan makes sense. I probably shouldn't wait for httpx v1, right?

@techouse techouse closed this Sep 9, 2025
@techouse techouse deleted the chore/add-qs-codec-to-docs branch September 9, 2025 21:52
@karpetrosyan
Copy link
Contributor

I have no context about v1, but I’d expect it to be pretty straightforward to port transports to the v1-compatible API.

@techouse
Copy link
Author

I would recommend to isolate it in a standalone repo, instead of documenting bunch of custom code. So a user can just import that transport and add it to his chain of transports. httpx-qs for example

Done! 😇 https://pypi.org/project/httpx-qs/

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