Getting 403 Client Error: Forbidden for url: when calling the same function twice

Hi,

I’m calling the following method twice in a row:
contract.functions.balanceOf(Web3.toChecksumAddress(eth_addr)).call()

and I get the following error with the second call:
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: <rinkeby_http_url>

I’m using web3.py. Are these calls ratelimited somehow? How can I fix that issue?

Hi @rbval can you confirm what block you querying the balance against?

Are you using the correct authentication for your account with the request?

Hi @mike

Seems like I don’t get this issue if I do the balance inquiry on the ‘latest’ block. However, if I try to do a balance on block stamp 1 day ago, I get that issue.

Why is this, isn’t Free Tier covering this? Do I need an archive node for this?

Best,
Robert

Hi Robert,

This query requires the archive data add-on because an archive node is needed to answer eth_getBalance requests greater than 128 blocks behind latest. There are ~5k blocks added in a day so a eth_getBalance request from a previous day would require archive data.

The archive data add-on is documented in more detail here.

Let me know if you have any other questions.