gpt4 book ai didi

python - 从 HTTP 响应获取 JSON?

转载 作者:行者123 更新时间:2023-11-30 22:12:39 25 4
gpt4 key购买 nike

https://omniexplorer.info/address/3MbYQMMmSkC3AgWkj9FMo5LsPTW1zBTwXL

https://i.imgur.com/DWHeELo.png

在imgur链接中,我想使用python获取JSON输出。
我通过在omniexplorer 站点上单击F12 进入imgur 页面,进入网络,然后单击0。

如何使用 python 获取以下 JSON 输出?

{
"address": "3MbYQMMmSkC3AgWkj9FMo5LsPTW1zBTwXL",
"pages": 10,
"transactions": [
{
"amount": "250000000.00000000",
"block": 529186,
"blockhash": "0000000000000000001102a848ce2e5bfa6dd69f14eb9afac04dd39cb75f350e",
"blocktime": 1529935167,
"confirmations": 51,
"divisible": true,
"fee": "0.00046501",
"ismine": false,
"positioninblock": 534,
"propertyid": 31,
"propertyname": "TetherUS",
"referenceaddress": "1NTMakcgVwQpMdGxRQnFKyb3G1FAJysSfz",
"sendingaddress": "3MbYQMMmSkC3AgWkj9FMo5LsPTW1zBTwXL",
"txid": "bd9520b9aea701e9606ad8a8f4d6852d70f2013b12df19b6d58147038392354e",
"type": "Grant Property Tokens",
"type_int": 55,
"valid": true,
"version": 0
},
{
"amount": "250000000.00000000",
"block": 523272,
"blockhash": "0000000000000000002e86cd0495daae675f2fbfa3f601dd2205e3d364f1705e",
"blocktime": 1526667641,
"confirmations": 5965,
"divisible": true,
"fee": "0.00046501",
"ismine": false,
"positioninblock": 256,
"propertyid": 31,
"propertyname": "TetherUS",
"referenceaddress": "1NTMakcgVwQpMdGxRQnFKyb3G1FAJysSfz",
"sendingaddress": "3MbYQMMmSkC3AgWkj9FMo5LsPTW1zBTwXL",
"txid": "23407cc132443fe5eff94d19ca016705623ca490c74d1a215a1026d801972263",
"type": "Grant Property Tokens",
"type_int": 55,
"valid": true,
"version": 0
},
{
"amount": "100.00000000",
"block": 519883,
"blockhash": "0000000000000000001a226aea1237aa124c741d73e897cc8384f273578a682e",
"blocktime": 1524671109,
"confirmations": 9354,
"divisible": true,
"fee": "0.00026055",
"invalidreason": "Sender is frozen for the property",
"ismine": false,
"positioninblock": 1324,
"propertyid": 31,
"propertyname": "TetherUS",
"referenceaddress": "3MbYQMMmSkC3AgWkj9FMo5LsPTW1zBTwXL",
"sendingaddress": "13K5cZHvDBR4Me39PLFS3JaPdaJocm8ygf",
"txid": "86b37baf4ce8935c4c892e9ce2577029951b072275e220ee1cd31e42c7b8a64b",
"type": "Simple Send",
"type_int": 0,
"valid": false,
"version": 0
},
{
"amount": "300000000.00000000",
"block": 514409,
"blockhash": "00000000000000000009f9a46950063c7cfa0b9c4a70ce97a64a498186398d5e",
"blocktime": 1521571874,
"confirmations": 14828,
"divisible": true,
"fee": "0.00014453",
"ismine": false,
"positioninblock": 1598,
"propertyid": 31,
"propertyname": "TetherUS",
"referenceaddress": "1NTMakcgVwQpMdGxRQnFKyb3G1FAJysSfz",
"sendingaddress": "3MbYQMMmSkC3AgWkj9FMo5LsPTW1zBTwXL",
"txid": "f3efac4b6203248fc06e2788b61e732319a6e596768f5240680f944780ff84f4",
"type": "Grant Property Tokens",
"type_int": 55,
"valid": true,
"version": 0
},
{
"block": 513109,
"blockhash": "0000000000000000003948c4093e0e7d99e9e03ac5f1e5b271a8a3a1e652f977",
"blocktime": 1520823390,
"confirmations": 16128,
"fee": "0.00015001",
"ismine": false,
"positioninblock": 222,
"propertyid": 31,
"propertyname": "TetherUS",
"referenceaddress": "1B4dCsH6MC9XoZ6ob2nngvJesYEfNNtMQS",
"sendingaddress": "3MbYQMMmSkC3AgWkj9FMo5LsPTW1zBTwXL",
"txid": "70be9bbbbd5de26b856d9cd3dfa5679f2badd10f03386bf26c0b99795608610f",
"type": "Freeze Property Tokens",
"type_int": 185,
"valid": true,
"version": 0
},
{
"block": 513109,
"blockhash": "0000000000000000003948c4093e0e7d99e9e03ac5f1e5b271a8a3a1e652f977",
"blocktime": 1520823390,
"confirmations": 16128,
"fee": "0.00015001",
"ismine": false,
"positioninblock": 221,
"propertyid": 31,
"propertyname": "TetherUS",
"referenceaddress": "1B6me5MvLP7Mu1yYXB8mbEVtsRsQkeYr6X",
"sendingaddress": "3MbYQMMmSkC3AgWkj9FMo5LsPTW1zBTwXL",
"txid": "e084ad7005731284d9f1743671e753f4380c6945a960d43b22004a78a63cfedf",
"type": "Freeze Property Tokens",
"type_int": 185,
"valid": true,
"version": 0
},
{
"block": 513109,
"blockhash": "0000000000000000003948c4093e0e7d99e9e03ac5f1e5b271a8a3a1e652f977",
"blocktime": 1520823390,
"confirmations": 16128,
"fee": "0.00015001",
"ismine": false,
"positioninblock": 220,
"propertyid": 31,
"propertyname": "TetherUS",
"referenceaddress": "13K5cZHvDBR4Me39PLFS3JaPdaJocm8ygf",
"sendingaddress": "3MbYQMMmSkC3AgWkj9FMo5LsPTW1zBTwXL",
"txid": "a5e0e79d454d98fbc0fa2cb226c08dd717f4265faec7a1f5316f89e9c27712d2",
"type": "Freeze Property Tokens",
"type_int": 185,
"valid": true,
"version": 0
},
{
"block": 513109,
"blockhash": "0000000000000000003948c4093e0e7d99e9e03ac5f1e5b271a8a3a1e652f977",
"blocktime": 1520823390,
"confirmations": 16128,
"fee": "0.00015001",
"ismine": false,
"positioninblock": 219,
"propertyid": 31,
"propertyname": "TetherUS",
"referenceaddress": "1PU73xR1fiRj1t3S44LtYiLqAr17tRcwfp",
"sendingaddress": "3MbYQMMmSkC3AgWkj9FMo5LsPTW1zBTwXL",
"txid": "0a21a9102312489adfa6208d9d37f2572175f9e39882c3b441fa1b0a0aff6511",
"type": "Freeze Property Tokens",
"type_int": 185,
"valid": true,
"version": 0
},
{
"amount": "1",
"block": 507793,
"blockhash": "0000000000000000003c8ca0a3edd5ab41de239ea26e282ad30e7f971fb4bcdb",
"blocktime": 1517841270,
"confirmations": 21444,
"divisible": false,
"fee": "0.00010000",
"ismine": false,
"positioninblock": 1137,
"propertyid": 321,
"propertyname": "Bitcoin Cash",
"referenceaddress": "3MbYQMMmSkC3AgWkj9FMo5LsPTW1zBTwXL",
"sendingaddress": "1Pzz7q2mUqAgbBkTvitPYxuub8WST9iYb3",
"txid": "6ea43cdbfc463276812c97b78bd96bea5ab5c944a9a2e6e0632f5b097b247c76",
"type": "Simple Send",
"type_int": 0,
"valid": true,
"version": 0
},
{
"amount": "30000000.00000000",
"block": 506983,
"blockhash": "000000000000000000064bf40b2625bda1df2746fb5a27cccb4e60e1a17b0454",
"blocktime": 1517412586,
"confirmations": 22254,
"divisible": true,
"fee": "0.00109885",
"ismine": false,
"positioninblock": 322,
"propertyid": 31,
"propertyname": "TetherUS",
"sendingaddress": "3MbYQMMmSkC3AgWkj9FMo5LsPTW1zBTwXL",
"txid": "24db40680654b8b505fda3e96be722ca10f341a129c99260509eb5d84655f1f0",
"type": "Revoke Property Tokens",
"type_int": 56,
"valid": true,
"version": 0
}
]
}

最佳答案

您可以右键点击0,然后复制为cURL,然后就可以 paste into this site

我将地址提取到变量中。安装 requests 库,该库具有 json() 输出函数

import requests

address = '3MbYQMMmSkC3AgWkj9FMo5LsPTW1zBTwXL'

headers = {
'origin': 'https://omniexplorer.info',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'en-US,en;q=0.9',
'user-agent': 'python-requests',
'content-type': 'application/x-www-form-urlencoded',
'accept': '*/*',
'referer': 'https://omniexplorer.info/address/{}'.format(address),
'authority': 'api.omniexplorer.info',
}

data = [('addr', address)]

response = requests.post('https://api.omniexplorer.info/v1/transaction/address/0', headers=headers, data=data)

print(response.json())

关于python - 从 HTTP 响应获取 JSON?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51032526/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com