Replies: 1 comment
-
They do not offer a ICS file (very few UK councils do), so you need to write a individual source. It probably needs to look something like this # Usual Source deffinitions (see contributing guide)
...
API_URL = "https://www.wolverhampton.gov.uk/find-my-nearest/{postcode}/{uprn}"
class Source:
def __init__(self, postcode:str, uprn:str|int):
self._postcode = postcode.replace(" ", "").upper().strip()
self._uprn = str(uprn).strip()
def fetch(self) -> List[Collection]:
r = requests.get(API_URL.format(postcode=self._postcode, uprn=self._uprn))
r.raise_for_status()
soup = BeautifulSoup(r.content, 'html.parser')
entries = []
... # parse the page to get the collection dates
return entries |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is as much as I know from my own research.
Sample URL is: https://www.wolverhampton.gov.uk/find-my-nearest/WV60DU/10007117025
WV60DU: is the postcode.
10007117025: is the UPRN number
General waste
XPath
//*[@id="block-omega-bigbluedoor-content"]/div/div/div[2]/div/div/div[1]/h4[2]
Element
Next date: November 05, 2024
Recycling Waste
XPath
//*[@id="block-omega-bigbluedoor-content"]/div/div/div[2]/div/div/div[2]/h4[2]
Element
Next date: November 12, 2024
I'm very new to this so learning as I go, thanks for any help.
Beta Was this translation helpful? Give feedback.
All reactions