bundesAPI / bundesAPI/handelsregister

Bugfix: Catch IndexError on search results

Open
#20 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
438
Forks
61
PR merge metrics
No merged PRs in 30d

Description

There exist search results where the logic to collect `'history'` does not apply and fails with an `IndexError`. A first and simple approach to this issue is to `continue` on `IndexError` and ignore corrupted information of entries.

Change the following lines in `handelsregister.py`...

```python
113 for i in range(hist_start, len(cells), 3):
114 d['history'].append((cells[i], cells[i+1])) # (name, location)
```
...to:

```python
113 for i in range(hist_start, len(cells), 3):
114 try:
115 d['history'].append((cells[i], cells[i+1])) # (name, location)
116 except IndexError: # there might be entries where this logic does not apply
117 continue
```

Alternatively the author(s) should have another look at the results and the parsing.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.