Skip to main content

Python wrapper for DDH Open API

Project description

WBDDH

WBDDH is a Python wrapper for World Bank Data Catalog Web APIs. It can be used for both DDH API v1.0 and v2.0.

Setup

Public users:

pip install -U wbddh

WB internal users:

pip install -U wbddh[internal]

DDH curators:

pip install -U wbddh[curation]

Usage

WBDDH handles HTTP requests and manages MSAL sessions.

Users first have to set API_host before using other functions:

import wbddh
wbddh.set_api_host(url)

Admin users first have to create a session to further run other admin functions:

import wbddh
session = wbddh.create_session(name='default_ddh_session', params=None, autoCopy=True, verify=None)

Users can send a simple GET/POST request:

wbddh.get(endpoint, params=None, headers=None, session=None)
wbddh.post(endpoint, params=None, json=None, headers=None, session=None)

Alternatively, users can repeat sending a GET/POST request until it succeeds or it tries {num_try} times:

wbddh.try_get(endpoint, params=None, headers=None, session=None, num_try=3, interval=300)
wbddh.try_post(endpoint, params=None, json=None, headers=None, session=None, num_try=3, interval=300)

There are two helper functions that fetch all data for endpoints that have paging parameters (ex. search, datasets):

wbddh.get_all_in_generator(endpoint, params=None, top_key="top", skip_key="skip", headers=None, session=None)
wbddh.get_all_in_list(endpoint, params=None, top_key="top", skip_key="skip", headers=None, session=None)

Authentication info for curation API

PROD

QA/UAT

DDH SharePoint

Examples

Jupyter Notebooks under examples folder show basic use cases utilizing wbddh.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

wbddh-0.1.14-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file wbddh-0.1.14-py3-none-any.whl.

File metadata

  • Download URL: wbddh-0.1.14-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.2 cpython/3.11.11 HTTPX/0.28.1

File hashes

Hashes for wbddh-0.1.14-py3-none-any.whl
Algorithm Hash digest
SHA256 082ba7ebe3aa9fdd9d8125968007a106cb5899cc8fa182a6615231f8d55fdd95
MD5 be6e607fe2d284d1460dd5dc4fe22d9b
BLAKE2b-256 421cf2ca1a44de5433e204633ee6459876b899a1688315176d148199b5f4a3ef

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