[英]Transaction via Blockchain API using Multiple recipients
Im trying to send bitcoins using Blockchain.info API to both adresses in 'recipes': 我试图使用Blockchain.info API将比特币发送给“配方”中的两个地址:
recipes ={'1Pd9gXJ8EqyGrqMKVevQWNjjF4B4dcSykf':10000,'14gVMjoCbjaGU3s9EQghVxYTAJgkmqqtHV':10000}
My request looks like: 我的要求如下:
url_multi = 'https://blockchain.info/nl/merchant/MYKEY/sendmany?password=MYPASSWORD&recipients='+recipes+'&fee=15000'
requests.get(url_multi)
I managed to send txs to single adresses using the examples in the documentation . 我设法使用文档中的示例将tx发送给单个地址。 However, sending to multiple adresses at once requires a dict according to the PHP-example.
但是,根据PHP示例,一次发送到多个地址需要一个命令。
In Python, the following Typerror gets returned; 在Python中,返回以下Typerror; TypeError: cannot concatenate 'str' and 'dict' objects
TypeError:无法连接“ str”和“ dict”对象
How do I add multiple recipients to the request without using a dict? 如何不使用字典将多个收件人添加到请求中?
recipes should have been a JSON object instead. 食谱应该是JSON对象。 So I converted it before adding it to the URL.
因此,我在将其添加到URL之前对其进行了转换。 Works fine now.
现在工作正常。
x = json.dumps(recipes)
url_multi = 'https://blockchain.info/nl/merchant/MYKEY/sendmany?password=MYPASSWORD&recipients='+x+'&fee=15000'
requests.get(url_multi)
I suck sometimes ;( 有时我吮吸;(
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.