bundesAPI / deutschland

Die wichtigsten APIs Deutschlands in einem Python Paket.
Apache License 2.0
1.16k stars 66 forks source link

Bundesanzeiger not working properly anymore #125

Closed baniasbaabe closed 9 months ago

baniasbaabe commented 10 months ago

Running the following sample code:

from deutschland.bundesanzeiger import Bundesanzeiger
ba = Bundesanzeiger()
data = ba.get_reports("Deutsche Bahn AG")

throws the following error:

[/usr/local/lib/python3.10/dist-packages/deutschland/bundesanzeiger/bundesanzeiger.py](https://localhost:8080/#) in __find_all_entries_on_page(self, page_content)
     88         soup = BeautifulSoup(page_content, "html.parser")
     89         wrapper = soup.find("div", {"class": "result_container"})
---> 90         rows = wrapper.find_all("div", {"class": "row"})
     91         for row in rows:
     92             info_element = row.find("div", {"class": "info"})

AttributeError: 'NoneType' object has no attribute 'find_all'
baniasbaabe commented 10 months ago

Nvm, Bundesanzeiger has downtime rn. But still, could a proper warning as an output be useful (if there are maintenance phases)?

wirthual commented 10 months ago

The bundesanzeiger API is not auto generated so it would be possible to add a simple check if the request to the server was successful before proceeding.

Happy to merge the needed changes if you want to tackle it.

matrop commented 9 months ago

Hey there, I'd like to tackle this issue if it's fine for you guys. Could you assign it to me?

wirthual commented 9 months ago

I merged your PR. Would be good to add an test case to see if the exection is thrown if the url is not availble :) E.g. test the __response method with an url which is not available.

Something like this

matrop commented 9 months ago

Sure, I'll create a new PR for this shortly 👍

wirthual commented 9 months ago

Tests also merged.