nixonjoshua98 / dexscreener

Python API wrapper for dexscreener.com
https://docs.dexscreener.com/api/reference
MIT License
104 stars 22 forks source link

Fix for when 'pairs' is not returned #6

Closed neochine closed 6 months ago

neochine commented 6 months ago

Functions returning pairs need not to be changed given it returns [] which is expected. Functions returning pair needs to decide whether to return None or raising Error

neochine commented 6 months ago

Needs to modify list as well but pretty sure other function just returned []

screener.get_token_pairs('...')
    return [TokenPair(**pair) for pair in resp["pairs"]]
TypeError: 'NoneType' object is not iterable
nixonjoshua98 commented 6 months ago

Looks fine. Maybe update the method signature to return Optional?

neochine commented 6 months ago

Does list[TokenPair] needs to be changed to list[Optional[TokenPair]]? I am not that good into typing. Modified -> TokenPair to Optional[TokenPair]

nixonjoshua98 commented 6 months ago

The list is fine.

nixonjoshua98 commented 6 months ago

I'll publish your fix tomorrow when I have time. Thanks for fixing it