Giter Site home page Giter Site logo

Comments (3)

hsyngmtrk avatar hsyngmtrk commented on May 31, 2024 1

Hello, I have been experiencing the same problem over and over again. I tried to tome up with different try-excepts, unfortunately none of them worked. Is it possible that you can write a try except code to avoid this assertion error? Thank you.

from bscscan-python.

pcko1 avatar pcko1 commented on May 31, 2024

I get what you mean.

I am afraid that this is a problem on BSCScan's side though, because they treat an empty list of transactions as an erroneous case, returning status code 0. From my side, if JSON response includes a status code of 0, I blindly handle it as an error and throw an exception. This is because a status code 0 may imply that either there are faulty parameter values or the address has no transactions.

For example:

  • Request 1 originally returns status code 1
  • Request 2 originally returns status code 0, thus it is handled as an error by this package

from bscscan-python.

k4vld avatar k4vld commented on May 31, 2024

Hello, I have been experiencing the same problem over and over again. I tried to tome up with different try-excepts, unfortunately none of them worked. Is it possible that you can write a try except code to avoid this assertion error? Thank you.

async def getTransferHistory(address, firstBlock, lastBlock):
try:
async with BscScan(YOUR_API_KEY) as bsc:
return await bsc.get_bep20_token_transfer_events_by_address(address, firstBlock, lastBlock, 'asc')
except Exception as E:
if str(E) == '[] -- No transactions found':
return []
else:
print(f'Cannot request history from {firstBlock} to {lastBlock} due to {E}')

from bscscan-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.