| 8 | |
| 9 | |
| 10 | class BlockFrostApi(Api): |
| 11 | |
| 12 | def __init__(self, project_id: str = None, base_url: str = None, api_version: str = None): |
| 13 | super().__init__( |
| 14 | project_id=project_id, |
| 15 | base_url=base_url if base_url else os.environ.get( |
| 16 | 'BLOCKFROST_API_URL', default=ApiUrls.mainnet.value), |
| 17 | # if custom base_url is specified then also use specified api_version |
| 18 | api_version=api_version if base_url else os.environ.get('BLOCKFROST_API_VERSION', |
| 19 | default=DEFAULT_API_VERSION)) |
| 20 | |
| 21 | @request_wrapper |
| 22 | def root(self, **kwargs): |
| 23 | """ |
| 24 | Root endpoint has no other function than to point end users to documentation. |
| 25 | |
| 26 | https://docs.blockfrost.io/#tag/health/GET/ |
| 27 | :param return_type: Optional. "object", "json" or "pandas". Default: "object". |
| 28 | :type return_type: str |
| 29 | :returns RootResponse object. |
| 30 | :rtype RootResponse |
| 31 | :raises ApiError: If API fails |
| 32 | :raises Exception: If the API response is somehow malformed. |
| 33 | """ |
| 34 | return requests.get( |
| 35 | url=f"{self.url}/", |
| 36 | headers=self.authentication_header |
| 37 | ) |
| 38 | |
| 39 | from .health import \ |
| 40 | health, \ |
| 41 | clock |
| 42 | from .metrics import \ |
| 43 | metrics, \ |
| 44 | metrics_endpoints |
| 45 | from .nutlink import \ |
| 46 | nutlink_address, \ |
| 47 | nutlink_address_tickers, \ |
| 48 | nutlink_address_ticker, \ |
| 49 | nutlink_ticker |
| 50 | from .cardano.accounts import \ |
| 51 | accounts, \ |
| 52 | account_rewards, \ |
| 53 | account_history, \ |
| 54 | account_delegations, \ |
| 55 | account_registrations, \ |
| 56 | account_withdrawals, \ |
| 57 | account_mirs, \ |
| 58 | account_addresses, \ |
| 59 | account_addresses_assets, \ |
| 60 | account_addresses_total, \ |
| 61 | account_utxos, \ |
| 62 | account_transactions |
| 63 | from .cardano.addresses import \ |
| 64 | address, \ |
| 65 | address_extended, \ |
| 66 | address_total, \ |
| 67 | address_utxos, \ |
no outgoing calls