如何使用Python从我的binance帐户VIE API获取TRON(TRC20)地址
我想从我的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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您可能不太了解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”在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 whyget('TRC20')
is returningNone
. If you usedget('url')
it would work and return a value since there is a key calledurl
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:The network name is found in the dropdown on the binance deposit address webpage. For TRC20 it's TRX.