-
Notifications
You must be signed in to change notification settings - Fork 15
Add support for Lite API #37
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
Add support for Lite API #37
Conversation
There was a problem hiding this comment.
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 adds support for IPinfo's Lite API by introducing new middleware classes that use the Lite API handlers. The Lite API provides a lightweight alternative to the full IPinfo API.
- Adds
IPinfoLiteMiddlewareandIPinfoAsyncLiteMiddlewareclasses that mirror existing middleware functionality - Updates the ipinfo library dependency to version 5.2.0+ to support Lite API handlers
- Refactors test structure to use fixtures for middleware configuration, enabling comprehensive testing of all middleware variants
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ipinfo_django/middleware.py | Adds new Lite middleware classes and minor code formatting improvements |
| setup.py | Bumps ipinfo library dependency to support Lite API handlers |
| tests/conftest.py | Adds pytest fixtures for configuring different middleware types in tests |
| tests/settings.py | Removes hardcoded middleware configuration to enable fixture-based testing |
| tests/test_middleware.py | New test file for standard IPinfo middleware |
| tests/test_lite_middleware.py | New test file for Lite middleware functionality |
| tests/test_async_middleware.py | Updates existing async tests to use new fixture system |
| tests/test_async_lite_middleware.py | New test file for async Lite middleware |
| tox.ini | Fixes tox configuration and standardizes test execution |
|
I mistakenly asked for a review by Copilot. 🤦♀️ |
max-ipinfo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to update the Django and/or Python versions we use to test?
https://github.com/ipinfo/django/blob/master/.github/workflows/test.yml#L13
max-ipinfo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No need to that right now, the version is the same as the one set in |
Similar approach to other libraries. I added
IPinfoLiteMiddlewareandIPinfoAsyncLiteMiddlewarethat the same functionality as the previous middlewares.I had to bump the
ipinfolibrary version insetup.pyas that's the first release that ships the Lite API handlers.I made some changes to
toxconfig as it wasn't working. Tests have been reworked too to use fixtures to customize which middlewares are set in the Django test configs, this way we can test all the middlewares. Previously only the async one was tested as that was hardcoded intests/settings.py.