fix(iapp_itouchvision_com): fetch Buckinghamshire from the council portal - #7323
fix(iapp_itouchvision_com): fetch Buckinghamshire from the council portal#7323kanthamohan wants to merge 1 commit into
Conversation
…rtal
Buckinghamshire (client 152, council 34505) retired its kmbd/collectionDay
data in August 2026. The endpoint still answers, but returns
{"collectionDay": null} for every Buckinghamshire UPRN, so fetch() failed
with "TypeError: 'NoneType' object is not iterable". The council now serves
the schedule from a form on the iTouchVision "My Council Services" portal.
Add an optional PORTAL_CUID to the municipality definitions. Municipalities
that carry one are fetched through the portal web service instead; all other
councils keep using the collectionDay API unchanged.
The portal path derives the form, web service and input identifiers at
runtime from the customer UID that the council website links to, so it keeps
working if the council edits the form. Those identifiers and the draft
service request the web service is addressed with are cached per source
instance, and rediscovered once if the portal discards the draft.
The portal renders dates as "Monday 7 September", without a year, so the
year is resolved by matching the weekday name across the neighbouring years.
An unknown UPRN is answered with a message instead of a table and now raises
SourceArgumentNotFound rather than crashing.
Both BUCKINGHAMSHIRE and AYLESBURY VALE are affected, as they share the same
client, and both are fixed here.
Fixes mampfes#7240
|
Still broken for me? |
|
Can you share a bit more detail please? Was it with this fix? If yes which local authority? |
Buckinghamshire: Formerly (Chiltern, South Bucks, Wycombe) |
|
This PR has not yet been accepted and it was only posted yesterday so it would not have made it into a release unless you manually pulled this and applied yourself. |
Ah OK - thank you. |
Summary
Fixes #7240.
Buckinghamshire (client 152, council 34505) retired its
kmbd/collectionDaydata in August 2026. The endpoint still answers, but returns{"collectionDay": null}for every Buckinghamshire UPRN, sofetch()failed withTypeError: 'NoneType' object is not iterable. Other councils on the same API (verified against Newport and Hyndburn) are unaffected.The council now serves the schedule from the "Check your next bin collection date" form on the iTouchVision "My Council Services" portal, which the council website links to.
This adds an optional
PORTAL_CUIDto the municipality definitions. Municipalities carrying one are fetched through the portal web service; every other council keeps using thecollectionDayAPI by exactly the same code path as before.Notes on the portal path:
strptime, which would depend on the host locale.SourceArgumentNotFoundcarrying that message.Authorizationheader.BUCKINGHAMSHIREandAYLESBURY VALEshare the same client, so both were broken and both are fixed here.The portal only publishes the next collection of each waste type, where the old API returned
collectionDayplusfollowingDay, so Buckinghamshire now yields fewer future dates. That is all the new service exposes;gdsv5/service/getkmbdcalendarreturns only a header for this council. This is noted in the source documentation.Also renames the
chiltern: 100080550517test case toBuckinghamshire: 100080550517(the municipality argument was alreadyBUCKINGHAMSHIRE), and addsICON_MAPentries for the two new waste type labels.Test results
python -m pytest tests/— 39 passed.python test_sources.py -s iapp_itouchvision_com -l— all 9 test cases return live data. Buckinghamshire and Aylesbury Vale are fixed; the other seven councils are unchanged:Additionally checked by hand: the discovered form is cached across fetches; a deliberately stale draft request id recovers on the next fetch; an unknown UPRN raises
SourceArgumentNotFound; and the date resolver returns the right year across a New Year boundary in both directions and on a leap day.Type of change
Checklist
python -m pytest tests/test_source_components.py -qpassesruff check --fixandruff formatrun on changed source filesdoc/source/<name>.mdcreated for new sources (n/a — existing doc updated)