如何使用Python从我的binance帐户VIE API获取TRON(TRC20)地址

发布于 2025-01-30 01:29:23 字数 789 浏览 4 评论 0原文

我想从我的binance帐户中获取我的tron(trc20)地址VIE API使用Python,但我得到的只是(ETH)网络地址。

**This is my code below.**
rom lib2to3.pygram import Symbols
import os
import config, csv
#and then import it in your python file with
from binance.client import Client
client = Client(config.api_key, config.api_secret)

address = client.get_deposit_address(tag='', coin='USDT')\
USDTron = (address.get('TRC20'))\

结果:

print(address)
Output: {'coin': 'USDT', 'address': '0x1892e6d25a9d91dea9f9caac549261e601af97f8', 'tag': '', 'url': 'https://etherscan.io/address/0x1892e6d25a9d91dea9f9caac549261e601af97f8'}
***(I got my Eth Network Address as the output)***

print(USDTron)
Output: None
**The output was (None)**

I wanted to get my Tron(TRC20) Address from my Binance Account vie API using Python, but all i got was my (Eth) Network Address.

**This is my code below.**
rom lib2to3.pygram import Symbols
import os
import config, csv
#and then import it in your python file with
from binance.client import Client
client = Client(config.api_key, config.api_secret)

address = client.get_deposit_address(tag='', coin='USDT')\
USDTron = (address.get('TRC20'))\

Results:

print(address)
Output: {'coin': 'USDT', 'address': '0x1892e6d25a9d91dea9f9caac549261e601af97f8', 'tag': '', 'url': 'https://etherscan.io/address/0x1892e6d25a9d91dea9f9caac549261e601af97f8'}
***(I got my Eth Network Address as the output)***

print(USDTron)
Output: None
**The output was (None)**

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

懵少女 2025-02-06 01:29:23

我相信您可能不太了解python dictionary get()方法做什么。

根据 w3schools get()方法返回指定的物品的值钥匙。”

来自client.get_deposit_address(tag ='',coin ='usdt')的输出不具有称为trc20代码>无。如果您使用get('url')它将起作用并返回值,因为字典中有一个称为url的密钥。

此外,要检索TRC20存款地址而不是默认的ERC20地址,您需要指定一个额外的可选参数,该参数称为network> network binance api < a href =“ https://binance-docs.github.io/apidocs/spot/spot/w.deposit-address-address-supporting-network-user_data” rel =“ nofollow noreferrer

address = client.get_deposit_address(tag='', coin='USDT', network='TRX')
USDTron = address.get('address')

”在Binance存款地址网页的下拉中找到。对于TRC20,它是TRX。

I believe you might not quite understand what the python dictionary get() method does.

According to W3schools "The get() method returns the value of the item with the specified key."

The output from client.get_deposit_address(tag='', coin='USDT') doesnt have a key called TRC20 which is why get('TRC20') is returning None. If you used get('url') it would work and return a value since there is a key called url in the dictionary.

Furthermore, in order to retrieve the TRC20 deposit address instead of the default ERC20 address, you need to specify an additional optional parameter which is called network as defined in the Binance API docs:

address = client.get_deposit_address(tag='', coin='USDT', network='TRX')
USDTron = address.get('address')

The network name is found in the dropdown on the binance deposit address webpage. For TRC20 it's TRX.

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文