-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Adding St Helens as Source #5446
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
base: master
Are you sure you want to change the base?
Adding St Helens as Source #5446
Conversation
| def __init__(self, postcode: str, uprn: str): | ||
| self._postcode = postcode.upper() | ||
| self._uprn = str(uprn).zfill(12) | ||
|
|
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.
| 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() |
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.
| 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) |
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.
why use zfill(12)?
| except Exception as err: | ||
| _LOGGER.error("Failed to get initial form and variables: %s", err) |
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.
Exception is logged but code will continue
consider to raise RuntimeError("Failed to get initial form") from err
| response = session.get( | ||
| "https://www.sthelens.gov.uk/article/3473/Check-your-collection-dates" | ||
| ) |
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.
| 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) |
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.
| response = session.post(api_url, data=payload) | |
| response = session.post(api_url, data=payload, timeout=30) |
same here
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.
consider to use URL to build api_url
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