Skip to content
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

Swale council producing an error #665

Closed
4 tasks done
Chewbacca222222 opened this issue Apr 4, 2024 · 13 comments · Fixed by #886
Closed
4 tasks done

Swale council producing an error #665

Chewbacca222222 opened this issue Apr 4, 2024 · 13 comments · Fixed by #886
Labels
bug Something isn't working

Comments

@Chewbacca222222
Copy link

Name of Council

Swale

Issue Information

When setting up the integration I get this error:

This error originated from a custom integration.

Logger: custom_components.uk_bin_collection.sensor
Source: helpers/update_coordinator.py:315
integration: UK Bin Collection Data (documentation, issues)
First occurred: 11:54:50 (1 occurrences)
Last logged: 11:54:50

Unexpected error fetching Home data: Could not parse council website.
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/uk_bin_collection/sensor.py", line 133, in _async_update_data
    data = await self.hass.async_add_executor_job(self.ukbcd.run)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/uk_bin_collection/uk_bin_collection/collect_data.py", line 96, in run
    return self.client_code(
           ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/uk_bin_collection/uk_bin_collection/collect_data.py", line 115, in client_code
    return get_bin_data_class.template_method(address_url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/uk_bin_collection/uk_bin_collection/get_bin_data.py", line 78, in template_method
    bin_data_dict = self.parse_data(
                    ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/uk_bin_collection/uk_bin_collection/councils/SwaleBoroughCouncil.py", line 34, in parse_data
    raise ConnectionAbortedError("Could not parse council website.")
ConnectionAbortedError: Could not parse council website.

Verification

  • I searched for similar issues at https://github.com/robbrad/UKBinCollectionData/issues?q=is:issue and found no duplicates
  • I have checked my address/postcode/UPRN works on the council's website
  • I have provided a detailed explanation of the issue as well as steps to replicate the issue
  • I understand that this project is run by volunteer contributors therefore completion of this issue cannot be guaranteed
@Chewbacca222222 Chewbacca222222 added the bug Something isn't working label Apr 4, 2024
@dp247
Copy link
Collaborator

dp247 commented Apr 4, 2024

Looks like the council website has been updated since the parser was written

@Chewbacca222222
Copy link
Author

@dp247 @robbrad Is someone able to walk me through the project setup? I'm happy to give a go fixing the issue but I can't get it set up on my machine, even after multiple attempts!

@dp247
Copy link
Collaborator

dp247 commented Jun 29, 2024

This is the way I set it up:

  1. Forked the repo to my GitHub account.
  2. Run the environment setup in Windows Terminal, then open the clone in Pycharm (I don't use venv, so my packages are installed to the system's version of Python, which I then use in Pycharm)
  3. In Pycharm, go to Run > Edit Configurations. I run Python 3.11 with the script set to the collect_data,py script. The run parameters (in the box below) can be found on the wiki - just don't include the python collect_data.py part.
  4. Open the council that I set run parameters for, then I can set breakpoints and debug.

@dolce08
Copy link

dolce08 commented Aug 24, 2024

Were you able to get this working for swale?

@Chewbacca222222
Copy link
Author

Chewbacca222222 commented Aug 24, 2024 via email

@dolce08
Copy link

dolce08 commented Sep 13, 2024

I've noted the council web address has changed slightly to https://swale.gov.uk/bins-littering-and-the-environment/bins/my-collection-day. Please could this be updated to see if it fixes the issue?

@Chewbacca222222
Copy link
Author

@dolce08 Hi yeah I noticed this too but it's a completely different process so simply updating the URL won't fix it!

@dolce08
Copy link

dolce08 commented Sep 13, 2024

Thanks for letting me know. I'll try to find the time to test in PyCharm

@robbrad
Copy link
Owner

robbrad commented Sep 13, 2024

Thanks for letting me know. I'll try to find the time to test in PyCharm

Just a heads up if you want: there is a devcontainer that works in vscode

@Chewbacca222222
Copy link
Author

So I've taken a good look at the website and I don't think it's going to be easy to replicate the request (I tried many things and couldn't get it to work). To that end I suggest switching over to Selenium, I have very little experience using devcontainers and Selenium but I'm happy to give it a go. However I'm not sure about anyone else but I get a fair few errors when launching that dev container, tried a few things to get it working but it can't seem to access some endpoints:

38.69 Err:2 http://deb.debian.org/debian bullseye InRelease
38.69   Connection failed [IP: 199.232.58.132 80]
39.77 Err:3 http://dl.google.com/linux/chrome/deb stable InRelease
39.77   Connection failed [IP: 142.250.187.206 80]
77.02 Err:4 http://deb.debian.org/debian-security bullseye-security InRelease
77.02   Connection failed [IP: 199.232.58.132 80]
115.4 Err:5 http://deb.debian.org/debian bullseye-updates InRelease
115.4   Connection failed [IP: 199.232.58.132 80]

@dp247
Copy link
Collaborator

dp247 commented Sep 16, 2024

So I've taken a good look at the website and I don't think it's going to be easy to replicate the request (I tried many things and couldn't get it to work). To that end I suggest switching over to Selenium, I have very little experience using devcontainers and Selenium but I'm happy to give it a go. However I'm not sure about anyone else but I get a fair few errors when launching that dev container, tried a few things to get it working but it can't seem to access some endpoints:

38.69 Err:2 http://deb.debian.org/debian bullseye InRelease
38.69   Connection failed [IP: 199.232.58.132 80]
39.77 Err:3 http://dl.google.com/linux/chrome/deb stable InRelease
39.77   Connection failed [IP: 142.250.187.206 80]
77.02 Err:4 http://deb.debian.org/debian-security bullseye-security InRelease
77.02   Connection failed [IP: 199.232.58.132 80]
115.4 Err:5 http://deb.debian.org/debian bullseye-updates InRelease
115.4   Connection failed [IP: 199.232.58.132 80]

You don't need the dev container per se, it just saves setting everything up manually

m26dvd added a commit to m26dvd/UKBinCollectionData that referenced this issue Oct 14, 2024
robbrad#665
This one contains a Cloudflare robot check so is very temperamental
@m26dvd
Copy link
Contributor

m26dvd commented Oct 14, 2024

I've fixed the logic on this one however Swale have introduced a Cloudflare check which sometimes means the check will fail.

I've not managed to find a way round this unfortunately

m26dvd added a commit to m26dvd/UKBinCollectionData that referenced this issue Oct 14, 2024
robbrad#665
This one contains a Cloudflare robot check so is very temperamental
@Chewbacca222222
Copy link
Author

I've fixed the logic on this one however Swale have introduced a Cloudflare check which sometimes means the check will fail.

I've not managed to find a way round this unfortunately

Thank you for fixing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants