首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >“错误!缺少或无效的操作名称”Etherscan错误

“错误!缺少或无效的操作名称”Etherscan错误
EN

Ethereum用户
提问于 2021-01-08 03:19:12
回答 1查看 1.7K关注 0票数 2

我在函数中创建了一个实用程序来使用Etherscan获取事务的状态。直到最近它一直运作良好。以下是功能:

代码语言:javascript
运行
复制
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

上面的函数返回:

代码语言:javascript
运行
复制
{
    'status': '0',
    'message': 'NOTOK',
    'result': 'Error! Missing Or invalid Action name'
}

代码中并没有什么改变。有什么不对的?

EN

回答 1

Ethereum用户

发布于 2021-05-06 19:37:54

尝试使用此标头

代码语言:javascript
运行
复制
'Content-Type': "application/x-www-form-urlencoded"

如果使用“Content”:"application/json“,则会引发该错误。

票数 2
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/92023

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档