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

Feat/add ttl to response #44

Merged
merged 6 commits into from
Jul 12, 2024
Merged

Feat/add ttl to response #44

merged 6 commits into from
Jul 12, 2024

Conversation

mnbf9rca
Copy link
Owner

@mnbf9rca mnbf9rca commented Jul 12, 2024

resolves #43

Summary by Sourcery

This pull request introduces a TTL (time-to-live) feature for API responses by calculating expiration times from the 'cache-control' header. It also updates the Pydantic models to include a 'content_expires' property and updates the README to document these changes.

  • New Features:
    • Added TTL (time-to-live) calculation for API responses based on the 'cache-control' header.
  • Enhancements:
    • Updated Pydantic models to include a 'content_expires' property for tracking TTL.
  • Documentation:
    • Updated README to document the new 'content_expires' property in response objects and its usage.

Copy link

sourcery-ai bot commented Jul 12, 2024

Reviewer's Guide by Sourcery

This pull request adds a Time-To-Live (TTL) feature to the response objects in the pydantic_tfl_api. The TTL is calculated based on the 's-maxage' directive in the 'cache-control' header of the HTTP response. The changes involve updating the client to parse this header and calculate the expiry time, and modifying the models to include a 'content_expires' field.

File-Level Changes

Files Changes
pydantic_tfl_api/models/line.py
pydantic_tfl_api/models/disruption.py
pydantic_tfl_api/models/mode.py
pydantic_tfl_api/models/prediction.py
pydantic_tfl_api/models/route_sequence.py
pydantic_tfl_api/models/stop_points_response.py
Added content_expires field to multiple models to store the calculated expiry time.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @mnbf9rca - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 9 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

pydantic_tfl_api/client.py Show resolved Hide resolved
pydantic_tfl_api/client.py Outdated Show resolved Hide resolved
pydantic_tfl_api/client.py Outdated Show resolved Hide resolved
pydantic_tfl_api/client.py Show resolved Hide resolved
pydantic_tfl_api/models/line.py Outdated Show resolved Hide resolved
pydantic_tfl_api/models/line.py Outdated Show resolved Hide resolved
pydantic_tfl_api/models/stop_point.py Outdated Show resolved Hide resolved
pydantic_tfl_api/client.py Outdated Show resolved Hide resolved
pydantic_tfl_api/client.py Outdated Show resolved Hide resolved
pydantic_tfl_api/client.py Show resolved Hide resolved
@mnbf9rca mnbf9rca merged commit 0c665d3 into main Jul 12, 2024
4 checks passed
@mnbf9rca mnbf9rca deleted the feat/add-ttl-to-response branch July 12, 2024 11:32
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.

add TTL/expiry to result object
1 participant