search
search()
async def search(sort: str, offset: int, limit: int, gift_name: str | list, model: str | list, backdrop: str | list, symbol: str | list, min_price: int, max_price: int, authData: str) -> list[PortalsGift]
Retrieve listed gifts
Returns
list
of PortalsGift
objects
Raises
authDataError
- ifauthData
is not providedgiftsError
:if
max_price
is less thanmin_price
ormin_price
andmax_price
are not integersif
gift_name
,model
,backdrop
orsymbol
are not strings or listsif
sort
is not one of the valid options
requestError
- if request fails
Parameters
sort
(str) - The sorting method for the results. Options are:"latest", "price_asc", "price_desc", "gift_id_asc", "gift_id_desc", "model_rarity_asc", "model_rarity_desc"
. Defaults to"price_asc"
.offset
(int) - pagination offset. For example, to get second page you need to setoffset
to1*limit
, third -2*limit
etc. Default is0
.limit
(int) - limit of gifts to show. Default is20
, maximum (for now) is100
.gift_name
(str | list, optional) - gift name / list of gift names to search formodel
(str | list, optional) - model name / list of model names to search forbackdrop
(str | list, optional) - backdrop name / list of backdrop names to search forsymbol
(str | list, optional) - symbol name / list of symbols to search formin_price
(int, optional) - min price of the searching giftsmax_price
(int, optional) - max price of the searching giftsauthData
(str) - authentication data required for the api request
PortalsGift object
Methods:
.toDict()
: Converts thePortalsGift
object back to a dictionary format.
Attributes:
.id
: The ID of the NFT..tg_id
: Telegram number of the gift (an external collection number)..collection_id
: The ID of the gift collection..name
: Name of the gift..photo_url
: URL of the photo from Fragment representing the gift (first frame of Lottie animation in PNG)..price
: Price of the gift..model
: Model of the gift..model_rarity
: Rarity percentage of the model..backdrop
: Backdrop of the gift..backdrop_rarity
: Rarity percentage of the backdrop..symbol
: Symbol of the gift..symbol_rarity
: Rarity percentage of the symbol..listed_at
: Date and time when the gift has been listed for sale..status
: Status of the gift (possible values: "listed", "unlisted", "withdrawn")..animation_url
: URL to the Lottie animation of the gift..emoji_id
: Custom Telegram emoji ID for the gift..floor_price
: Floor price of the gift's collection..unlocks_at
: Date and time when the gift will be mintable (unsure if correct).
Example
Print gift price and floor price for every gift from latest
from aportalsmp.gifts import search
from aportalsmp.auth import update_auth
import asyncio
auth = asyncio.run(update_auth(api_id=123, api_hash="..."))
async def main():
latest_gifts = await search(sort = "latest", authData = auth)
for gift in latest_gifts:
print(f"{gift.name}-{gift.tg_id} - price: {gift.price}, floor: {gift.floor_price}")
See used functions: update_auth
Last updated