I am trying to send a request to Etherscan API in the Ropsten network and it is not working as it shows 403 error:
response = requests.get(
"https://api-ropsten.etherscan.io/api",
params={
"module": "account",
"action": "balance",
"address": "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae",
"tag": "latest",
"apikey": "MyApiKey",
},
)
It is very awkward because when I do the same from Postman with this url, it works:
https://api-ropsten.etherscan.io/api?module=account&action=balance&address=0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae&tag=latest&apikey=MyApiKey
And, when I do the same request to the Ethereum Mainnet, it works as well:
response = requests.get(
"https://api.etherscan.io/api",
params={
"module": "account",
"action": "balance",
"address": "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae",
"tag": "latest",
"apikey": "MyApiKey",
},
)