Registry / analytics / wbgapi

wbgapi

JSON →
library1.0.14pypypi✓ verified 83d ago

wbgapi provides a comprehensive interface to the World Bank's data and metadata APIs. Current version 1.0.14, supports Python >=3.0. Updates are infrequent.

pip install wbgapi
INSTALL
IMPORT
SIG · WBGAPI
W
wbgapi
analyticspythonv1.0.14
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

wbgapi
import wbgapi

Fetch World Bank data series for a specific indicator and economy.

import wbgapi # Fetch GDP data for USA (indicator NY.GDP.MKTP.CD) for 2019-2021 series = wbgapi.data.fetch('NY.GDP.MKTP.CD', economy='USA', time=range(2019,2022)) print(series.to_dict())
Debug
Known issues
gotchaAPI key is not required for public data access; the library uses the World Bank's public API which does not require authentication.
fix
No key needed. Do not attempt to set an API key.
affects: all
deprecatedThe method `wbgapi.series.info()` has been deprecated in favor of `wbgapi.series.metadata()`.
fix
Use `wbgapi.series.metadata('NY.GDP.MKTP.CD')` instead of `wbgapi.series.info('NY.GDP.MKTP.CD')`.
affects: >=1.0.0
gotchaThe `economy` parameter expects a 3-letter country code (e.g., 'USA'), not a country name.
fix
Use valid ISO 3-letter codes. Use `wbgapi.economy.list()` to see available codes.
affects: all
gotchaDate/time ranges are inclusive-exclusive: `time=range(2019,2022)` returns data for 2019, 2020, 2021 (not 2022).
fix
Ensure the end of the range is one year after the last desired year.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'wbgapi'
Library not installed in the current environment.
fix
Run 'pip install wbgapi' to install.
KeyError: 'NY.GDP.MKTP.CD'
Invalid indicator code or case sensitivity issue.
fix
Check indicator code spelling and case; use `wbgapi.series.list()` to find correct codes.
wbgapi.error.APIError: Invalid value for the 'economy' parameter
Country code is not a valid 3-letter code or is empty.
fix
Use a valid ISO 3-letter country code; see `wbgapi.economy.list()` for options.
Upgrade
Version history
1.0.14latest on PyPI · released Feb 27, 2026
Audit
Dependencies
requestsrequiredHTTP library
Agent activity
46 hits · last 30 days
node
40
OpenAI (training)
1
Resources
wbgapi — pip install wbgapi · libregistry