Skip to content

Conversation

@SheepWizard
Copy link

@SheepWizard SheepWizard commented Dec 10, 2025

Endpoint changed from POST request to GET
#1767

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Improved bin collection data retrieval reliability for Buckinghamshire through updated request protocol.
    • Enhanced error handling and response validation for better troubleshooting when data retrieval fails.
    • Updated system communication headers for improved compatibility.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 10, 2025

Walkthrough

Modifies BuckinghamshireCouncil API requests from POST to GET with parameterized URL format. Updates User-Agent header, adjusts error handling to truncate response text for consistency, and applies minor formatting changes.

Changes

Cohort / File(s) Summary
Buckinghamshire Council API Request Refactor
uk_bin_collection/uk_bin_collection/councils/BuckinghamshireCouncil.py
Changed HTTP method from POST to GET with URL parameters; updated User-Agent header; modified error handling to truncate response text to first 200 characters; adjusted non-hex output validation with consistent message formatting

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify that the GET request with parameterized URL (P_PARAMETER={encoded_input}) functions equivalently to the previous POST method
  • Confirm response text truncation ([:200]) is sufficient for error diagnostics and doesn't mask critical failure information
  • Validate User-Agent header string is complete and properly formatted after the trailing comma modification

Poem

🐰 A shift from POST to GET so neat,
Parameters dance in the URL's beat,
Error truncation keeps things tidy and bright,
Buckinghamshire's binaries shine just right! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix buckinghamshire council endpoint' directly corresponds to the main change in the pull request, which updates the Buckinghamshire council endpoint from POST to GET.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Dec 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.81%. Comparing base (83cce53) to head (462389d).
⚠️ Report is 4 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1773   +/-   ##
=======================================
  Coverage   86.81%   86.81%           
=======================================
  Files           9        9           
  Lines        1138     1138           
=======================================
  Hits          988      988           
  Misses        150      150           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
uk_bin_collection/uk_bin_collection/councils/BuckinghamshireCouncil.py (2)

76-84: GET migration and URL construction look fine; consider params for clarity

The switch to session.get with P_PARAMETER={encoded_input} is consistent with a GET-style API, and using a hex string here is URL-safe. For readability and to avoid manual query-string construction, you could instead rely on params:

response = session.get(
    "https://itouchvision.app/portal/itouchvision/kmbd/collectionDay",
    headers=headers,
    params={"P_PARAMETER": encoded_input},
)

This makes it a bit clearer what’s part of the base URL vs query parameters.


86-99: Error handling is solid; optional refactor to de-duplicate long messages

The status-code check plus the “hex-like” validation give good early failure signals and concise, truncated context from the response. The two ValueError raises (Lines 88-90 and 96-98) share a very similar long message shape, which is exactly what Ruff’s TRY003/TRY301 are flagging.

If you want to quiet those hints and tighten things up, consider extracting a small helper that formats these API errors (including the response.text[:200] snippet) and reuse it in both branches, or define a small custom exception that encapsulates the formatting. Functionally you’re in good shape either way; this would just reduce duplication and keep the call-site strings shorter.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 83cce53 and 462389d.

📒 Files selected for processing (1)
  • uk_bin_collection/uk_bin_collection/councils/BuckinghamshireCouncil.py (1 hunks)
🧰 Additional context used
🪛 Ruff (0.14.8)
uk_bin_collection/uk_bin_collection/councils/BuckinghamshireCouncil.py

88-90: Abstract raise to an inner function

(TRY301)


88-90: Avoid specifying long messages outside the exception class

(TRY003)


96-98: Abstract raise to an inner function

(TRY301)


96-98: Avoid specifying long messages outside the exception class

(TRY003)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Run Unit Tests (3.12, 1.8.4)
  • GitHub Check: Run Integration Tests (3.12, 1.8.4)

@robbrad robbrad closed this Jan 14, 2026
@SheepWizard
Copy link
Author

Why was this closed?

@robbrad
Copy link
Owner

robbrad commented Jan 14, 2026

Merged into January release

@robbrad
Copy link
Owner

robbrad commented Jan 14, 2026

#1807

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