deutschland
deutschland copied to clipboard
bundesanzeiger: allow fetching multiple pages for one company
The current Bundesanzeiger implementation only fetches one page of results with up to 20 reports, but sometimes it might be interesting to get older reports as well.
This adds a named parameter page_limit
to Bundesanzeiger.get_reports
. The default value is 1, which preserves the current behavior of fetching only one page. If a higher value is set, the client will search the returned HTML for a "next page" link, and keep generating reports until page_limits pages have been parsed or there is no "next page" link anymore. float('inf')
can be passed to fetch all available pages.
This commit adds a unit test for the method to find the "next page" link and another to test that it actually generates more than 20 reports.
This also encodes the company name in the URL so that search terms like "Saxony Minerals & Exploration - SME AG"
work correctly.