Query
To query keys from an account aggregate, you need to call the
fetch_aggregate
function on the client.
Since version 0.8.0, only the asynchronous methods are available.
Usage
It exists two methods to query an aggregate:
fetch_aggregate
: Query a single keyfetch_aggregates
: Query all keys.
Parameters
Parameter | Type | Description |
---|---|---|
address |
String | The address of the aggregate to query. |
key |
String | The key of the aggregate to query. |
Example
from aleph.sdk.client import AlephHttpClient
async def main():
async with AlephHttpClient() as client:
aggregate = await client.fetch_aggregates(
"0xbC80BeEcBd67549E70cb1C729e903818E6370D37",
)
print(aggregate)
from aleph.sdk.client import AlephHttpClient
async def main():
async with AlephHttpClient() as client:
aggregate = await client.fetch_aggregate(
"0xbC80BeEcBd67549E70cb1C729e903818E6370D37",
"profile",
)
print(aggregate)
outputs:
respectively:
Note
It is also possible to retrieve an aggregate from the API endpoint like this.