web3data.handlers.base

This module contains the API handler’s base class.

class web3data.handlers.base.BaseHandler(chain: web3data.chains.Chains)[source]

Bases: object

The API handler base class.

This class defines the basic methods of performing REST API endpoint queries as well as RPC queries, which are implemented across all handler classes to standardize API requests.

LIMITED = (<Chains.BTC: 1>, <Chains.BCH: 2>, <Chains.BSV: 3>, <Chains.LTC: 6>, <Chains.ZEC: 7>)
static raw_query(base_url: str, route: str, headers: Dict[str, str], params: Dict[str, str]) → Union[Dict, str][source]

Perform an HTTP GET request on an API REST endpoint.

Parameters
  • base_url – The API base URL (common prefix)

  • route – The endpoint route after the base (variable suffix)

  • headers – Headers to attach to the API request

  • params – Query parameters to attach to the URL

Returns

The API response parsed into a dict