I am currently using the python-bscscan documentation with my wallet address to access token transfers for a given contract address. Here is the link to the documentation: https://bscscan-python.pankotsias.com/bscscan.modules.html#module-bscscan.modules.accounts/
This is my code that I have so far:
from bscscan import BscScan async def get_contents(): async with BscScan(bsc_address) as client: print( await client.get_bep20_token_transfer_events_by_address( address="0x0000000000000000000000000000000000001004", startblock=0, endblock=999999999, sort="asc" ) ) asyncio.run(get_contents())
When I run this snippet of code, I get the following error: RuntimeError Traceback (most recent call last) in () 10 ) 11 ) ---> 12 asyncio.run(get_contents())
/usr/lib/python3.7/asyncio/runners.py in run(main, debug) 32 if events._get_running_loop() is not None: 33 raise RuntimeError( ---> 34 "asyncio.run() cannot be called from a running event loop") 35 36 if not coroutines.iscoroutine(main):
RuntimeError: asyncio.run() cannot be called from a running event loop
Other StackOverflow posts have suggested installing nest_asyncio, using an if/else conditional with the if statement containing the main() and else containing asyncio.run(). I have tried both ways but still, get the same error.
I am unsure why I am receiving this error. If I could get some clarification as to how to move forward, that would be great. Also, if there are other examples of Binance Smart Chain python available, I would appreciate some more resources.
[link] [comments]
You can get bonuses upto $100 FREE BONUS when you:
π° Install these recommended apps:
π² SocialGood - 100% Crypto Back on Everyday Shopping
π² xPortal - The DeFi For The Next Billion
π² CryptoTab Browser - Lightweight, fast, and ready to mine!
π° Register on these recommended exchanges:
π‘ Binanceπ‘ Bitfinexπ‘ Bitmartπ‘ Bittrexπ‘ Bitget
π‘ CoinExπ‘ Crypto.comπ‘ Gate.ioπ‘ Huobiπ‘ Kucoin.
Comments