我正在尝试向 Ropsten 网络中的 Etherscan API 发送请求,但它无法正常工作,因为它显示 403 错误:
response = requests.get(
"https://api-ropsten.etherscan.io/api",
params={
"module": "account",
"action": "balance",
"address": "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae",
"tag": "latest",
"apikey": "MyApiKey",
},
)
这很尴尬,因为当我从 Postman 使用这个 url 做同样的事情时,它可以工作:
https://api-ropsten.etherscan.io/api?module=account&action=balance&address=0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae&tag=latest&apikey=MyApiKey
而且,当我向以太坊主网发出同样的请求时,它也能正常工作:
response = requests.get(
"https://api.etherscan.io/api",
params={
"module": "account",
"action": "balance",
"address": "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae",
"tag": "latest",
"apikey": "MyApiKey",
},
)