Skip to content

Lectures that call the World Bank API fail their build when the API is slow or down #668

Open

Description

@mmcky

lectures/pandas.md fetches data from api.worldbank.org through wbgapi while it builds: import wbgapi as wb at line 615, then wb.series.info('GC.DOD.TOTL.GD.ZS') and wb.data.DataFrame('GC.DOD.TOTL.GD.ZS', …) at lines 616 and 620.

The calls set no timeout and no retry, so a 502 from the API fails the cell, and a request that hangs runs to the 600 s cell timeout. That is how lecture-python-intro's World Bank lectures failed in QuantEcon/actions' lecture matrix on 2026-11-16 and 2026-11-17 (see QuantEcon/actions#333 and QuantEcon/lecture-python-intro#877). This repository's jobs passed in those runs, but pandas.md has the same exposure.

A possible change: a hidden setup cell after import wbgapi as wb that sets a request timeout (wbgapi 1.0.14 passes wb.get_options to requests.get, so wb.get_options['timeout'] = 60 works) and retries a failed request up to three times. A timeout alone would turn slow successes into failures, so the retry matters. wbgapi has no public retry option: a retry means wrapping its private _queryAPI, or a change in wbgapi itself. Any such change touches lecture content, so it needs a person's review before it merges.

Activity

  1. mmcky commented on Nov 22, 2026

    @mmcky
    ContributorAuthor

    pandas.md teaches fetching data from a web API (its section "Using wbgapi and yfinance to Access Data"), so the live call stays. This stays open while the approach is decided: for example, re-running a lecture when a build fails on a network error, rather than changing lecture code for intermittent outages. The intro lectures are sorted out in QuantEcon/lecture-python-intro#877.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions