wbdata icon indicating copy to clipboard operation
wbdata copied to clipboard

wbdata does not handle indicators with no data

Open EdGaere opened this issue 10 months ago • 1 comments

Problem: Some indicators have no data but wbdata loops endlessly, incrementing the requested page on each request.

Example https://api.worldbank.org/v2/sources/85/indicators

Response

<wb:indicators page="1" pages="0" per_page="50" total="0"/>

Solution: early exit if WorldBank API returns pages=0

fetcher.py

def fetch(url, ..):
    while pages != this_page:
        ...
        if pages == 0: # early exit if WorldBank API returns pages=0
            break

EdGaere avatar Mar 24 '24 07:03 EdGaere

Thanks for the report, I'll get that patched and try not to think about why they have indicators with no data.

OliverSherouse avatar Mar 26 '24 01:03 OliverSherouse