我在函数中创建了一个实用程序来使用Etherscan获取事务的状态。直到最近它一直运作良好。以下是功能:
def get_eth_or_usdt_transaction_status(transaction_hash, currency):
action = "gettxreceiptstatus" if currency == ETHEREUM else "getstatus"
url = f"{etherscan_base_url}?module=transaction&action={action}\
&txhash={transaction_hash}&apikey={settings.ETHERSCAN_API_KEY}"
url = strip_str(url, "url")
response = requests.get(url, headers=headers).json()
return response上面的函数返回:
{
'status': '0',
'message': 'NOTOK',
'result': 'Error! Missing Or invalid Action name'
}代码中并没有什么改变。有什么不对的?
发布于 2021-05-06 19:37:54
尝试使用此标头
'Content-Type': "application/x-www-form-urlencoded"如果使用“Content”:"application/json“,则会引发该错误。
https://ethereum.stackexchange.com/questions/92023
复制相似问题