Skip to content

Conversation

@gary-dickenson
Copy link

@gary-dickenson gary-dickenson commented Feb 4, 2026

Adding source for St Helens town. Ive checked and the authority does not expose any apis 😞, so falling back to dedicated source πŸ˜„ .

βœ… Documentation updated
βœ… Unit tests Passed
βœ… Local Testing of Integration Passed

def __init__(self, postcode: str, uprn: str):
self._postcode = postcode.upper()
self._uprn = str(uprn).zfill(12)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if not self._postcode:
raise SourceArgumentException(postcode, "Postcode is required")
if not self._uprn.isdigit():
raise SourceArgumentException(uprn, "UPRN must be numeric")


class Source:
def __init__(self, postcode: str, uprn: str):
self._postcode = postcode.upper()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
self._postcode = postcode.upper()
self._postcode = postcode.strip().upper()

class Source:
def __init__(self, postcode: str, uprn: str):
self._postcode = postcode.upper()
self._uprn = str(uprn).zfill(12)
Copy link
Collaborator

Choose a reason for hiding this comment

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

why use zfill(12)?

Comment on lines +47 to +48
except Exception as err:
_LOGGER.error("Failed to get initial form and variables: %s", err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Exception is logged but code will continue
consider to raise RuntimeError("Failed to get initial form") from err

Comment on lines +44 to +46
response = session.get(
"https://www.sthelens.gov.uk/article/3473/Check-your-collection-dates"
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
response = session.get(
"https://www.sthelens.gov.uk/article/3473/Check-your-collection-dates"
)
response = session.get(
"https://www.sthelens.gov.uk/article/3473/Check-your-collection-dates",
timeout=30
)

use timeout

)

try:
response = session.post(api_url, data=payload)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
response = session.post(api_url, data=payload)
response = session.post(api_url, data=payload, timeout=30)

same here

Copy link
Collaborator

@bbr111 bbr111 left a comment

Choose a reason for hiding this comment

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

consider to use URL to build api_url

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