-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinspect_ankr_types.py
More file actions
36 lines (28 loc) · 979 Bytes
/
inspect_ankr_types.py
File metadata and controls
36 lines (28 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""
Script to inspect Ankr SDK request types and their parameters
"""
import inspect
from typing import Type
from ankr.types import (
GetAccountBalanceRequest,
GetBlockchainStatsRequest,
GetBlocksRequest,
GetNFTMetadataRequest,
GetNFTsByOwnerRequest,
GetTokenPriceRequest,
)
def print_class_params(cls: Type) -> None:
"""Print the parameters for a class constructor"""
print(f"\n{cls.__name__} parameters:")
sig = inspect.signature(cls.__init__)
for param_name, param in sig.parameters.items():
if param_name != "self":
print(
f" - {param_name}: {param.default if param.default is not inspect.Parameter.empty else 'REQUIRED'}"
)
print_class_params(GetNFTsByOwnerRequest)
print_class_params(GetNFTMetadataRequest)
print_class_params(GetBlockchainStatsRequest)
print_class_params(GetBlocksRequest)
print_class_params(GetAccountBalanceRequest)
print_class_params(GetTokenPriceRequest)