GZW DataPython client
Live API

Python,
without the plumbing.

A small client for Python 3.9+ with no dependencies. It handles pagination, search, retries that honour Retry-After, and structured errors.

Install from PyPI
pip install gzw-data
Dependencies0Built on the standard library only.
AuthenticationNoneNo API key or account is required.
Python3.9+Tested on 3.9, 3.11 and 3.13.
Same data as every other clientDatasets are resolved from the live API.New datasets work immediately with client.list("name"). There is nothing to update in the package when the data grows.

Install and make a request

Install the package from PyPI. No API key is needed.

pip install gzw-data
from gzw_data import GzwDataClient client = GzwDataClient() weapon = client.get("weapons", "ak-12") print(weapon["name"], weapon["caliber"]) page = client.list("weapons", per_page=5) print(page["total"], [w["name"] for w in page["data"]])

Every method returns plain dictionaries and lists, exactly as the API sends them.

Datasets and records

datasets() maps every dataset name to its record count. get() returns one record, or None when the id does not exist. iterate() walks every page for you.

names = client.datasets() # {'ammo': 79, 'weapons': 44, ...} print(len(names), "datasets") record = client.get("weapons", "does-not-exist") # None for ammo in client.iterate("ammo"): # every record, page by page print(ammo["name"])

list() returns one page with the full response envelope: data, page, perPage, total and totalPages.

Errors and retries

Failures raise GzwApiError with status, a stable code, the request url and, for rate limits, retry_after in seconds. Rate-limit (429) and server (5xx) responses are retried with backoff, and a Retry-After header is honoured up to max_retry_wait. Client errors such as 404 or 400 are not retried.

from gzw_data import GzwApiError, GzwDataClient client = GzwDataClient() try: client.list("not_a_dataset") except GzwApiError as error: print(error.status, error.code) # 404 ENDPOINT_NOT_FOUND

Configuration

All options are keyword arguments of GzwDataClient.

client = GzwDataClient( base_url="https://gzw-data.dev/api/v1", # default timeout=10.0, # seconds per request retries=2, # extra attempts after the first max_retry_wait=65.0, # longest Retry-After to wait for user_agent="my-bot/1.0", )

For tests, pass opener= with a function that behaves like urllib.request.urlopen; the client's own test suite does this.

Rate limit

  • The API allows about 100 requests per minute per IP address, on a best-effort basis.
  • iterate() reads 100 records per request. Walking all 90 datasets takes roughly 90 requests, so cache results in a long-running bot instead of scanning on every command.
  • The client waits and retries when the limit is hit, which can make a large scan pause for up to a minute.

For endpoint behaviour, query parameters and response envelopes, see the API reference. For JavaScript and TypeScript, see the SDK guide.

Ask the right project

Report client behaviour to the Python client repository. Report missing or wrong game data through the feedback desk.

☕ Support GZW Data