Skip to main content

Python client for the Macroeconomy Indicators API

Project description

macro-indicators

Python client for the Macroeconomy Indicators API (World Bank data).

  • No dependencies beyond requests
  • Function-based API
  • Annual data (2000–present)
  • 10 key macroeconomic indicators (GDP, inflation, unemployment, M2, debt-to-GDP, etc.)
  • Country coverage: ~180 countries with available World Bank data
  • Data source: World Bank Open Data
  • Updates: monthly snapshots

Installation

pip install macro-indicators

Quick usage

from macro_indicators import root, get_country_codes, get_country_data

print(root())
# {"message": "Welcome to the Macroeconomy Indicators API"}

codes = get_country_codes()
print("Sample:", codes[:5])

data = get_country_data("SWE", "M2_LCU", 2010, 2015)
print("Years:", data["years"])
print("Values:", data["values"])

Error handling

This client raises typed exceptions and forwards the server’s detail messages:

  • BadRequest (400): invalid parameter bounds (e.g. years out of range)
  • NotFound (404): missing country or indicator
  • MacroAPIError: other HTTP/network errors

API reference

  • root() -> dict
  • get_country_codes() -> list[str]
  • get_countries_with_names() -> dict[str, str]
  • get_indicators() -> list[dict]
  • get_country_data(country_code: str, indicator: str, start_year: int, end_year: int) -> dict

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

macro_indicators-0.0.3.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

macro_indicators-0.0.3-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file macro_indicators-0.0.3.tar.gz.

File metadata

  • Download URL: macro_indicators-0.0.3.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for macro_indicators-0.0.3.tar.gz
Algorithm Hash digest
SHA256 8eb8c06b7a1abd5e97c3f3802bdf5a3384ff25417b9d69d5dc6544efd76bb66f
MD5 c06e72dd723e646010e5176feff5c6ed
BLAKE2b-256 723547483aa760089e16cf0a79d2d507a1d6f7824ea9c670da10220ce5074b61

See more details on using hashes here.

File details

Details for the file macro_indicators-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for macro_indicators-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7704291cb89b88291eff6340829473dcbd88ec93af9e9ce51c14185031c31262
MD5 387f91043eebc45149c5b333ec9fc65b
BLAKE2b-256 552fbad35ad8372d5264a9e5372589215f9e21549be766f2f34d55b02659625f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page