Имеется json файл который я получаю от API
{"id": 258580, "worker_type": 0, "name": "Vega56", "online_status": 1, "mpu_list": [{"id": 0, "type": 1, "name": "AMD RX Vega 56", "memory_total": 8573157376, "memory_type": "Samsung HBM2", "vbios": "113-D0500300-102", "power": 117.0, "hashrate": 53350000, "temp": 36, "fan_percent": 54, "fan_rpm": 0, "is_enabled": 0, "oc_config": {"id": 0, "core_clock": 0, "memory_clock": 0, "power": 0.0, "fan": 0, "reset": 0, "is_used": 0, "vbios": "N/A", "memory_type": "N/A", "guid": "367407445ec34b190a00641abb4775bf", "disabled": 0, "memory_power": 0, "target_temp": 0, "exec": ""}, "guid": "367407445ec34b190a00641abb4775bf", "shares": {"invalid": 0, "accepted": 400, "rejected": 0, "bad": 0.0}}, {"id": 1, "type": 1, "name": "AMD RX Vega 56", "memory_total": 8573157376, "memory_type": "Samsung HBM2", "vbios": "113-D0500350-100", "power": 112.0, "hashrate": 54210000, "temp": 27, "fan_percent": 27, "fan_rpm": 0, "is_enabled": 0, "oc_config": {"id": 1, "core_clock": 0, "memory_clock": 0, "power": 0.0, "fan": 0, "reset": 0, "is_used": 0, "vbios": "N/A", "memory_type": "N/A", "guid": "a6ad77c9d6257226792fb2df97b84a27", "disabled": 0, "memory_power": 0, "target_temp": 0, "exec": ""}, "guid": "a6ad77c9d6257226792fb2df97b84a27", "shares": {"invalid": 0, "accepted": 369, "rejected": 0, "bad": 0.0}}, {"id": 2, "type": 1, "name": "Gigabyte RX Vega 56", "memory_total": 8573157376, "memory_type": "Samsung HBM2", "vbios": "113-EXT33736-001", "power": 164.0, "hashrate": 50740000, "temp": 31, "fan_percent": 43, "fan_rpm": 0, "is_enabled": 0, "oc_config": {"id": 2, "core_clock": 0, "memory_clock": 0, "power": 0.0, "fan": 0, "reset": 0, "is_used": 0, "vbios": "N/A", "memory_type": "N/A", "guid": "16bb74ba376ec978c36457b58235b063", "disabled": 0, "memory_power": 0, "target_temp": 0, "exec": ""}, "guid": "16bb74ba376ec978c36457b58235b063", "shares": {"invalid": 0, "accepted": 322, "rejected": 0, "bad": 0.0}}, {"id": 3, "type": 1, "name": "ASUS RX Vega 56", "memory_total": 8573157376, "memory_type": "Hynix HBM2", "vbios": "115-D050PIL-100", "power": 109.0, "hashrate": 50310000, "temp": 36, "fan_percent": 50, "fan_rpm": 0, "is_enabled": 0, "oc_config": {"id": 3, "core_clock": 0, "memory_clock": 0, "power": 0.0, "fan": 0, "reset": 0, "is_used": 0, "vbios": "N/A", "memory_type": "N/A", "guid": "9a9e6a56ac6682a343a22a0cd59c06de", "disabled": 0, "memory_power": 0, "target_temp": 0, "exec": ""}, "guid": "9a9e6a56ac6682a343a22a0cd59c06de", "shares": {"invalid": 0, "accepted": 334, "rejected": 0, "bad": 0.0}}], "sys_info": {"sw_version": "1.0.25", "os_build_no": "8650", "os_kernel": "5.10.3-mining-mod", "sw_build": "1950", "boot_time": 56518, "version_detail": {"date": "2021-03-11 13:01:27", "build": "1950", "commit": "4a55278498f21e7e7fced6e917e70de2ea714717"}, "mb_info": {"disk_total": 57092648960, "mb_name": "ASRock H81 Pro BTC R2.0", "memory_total": 4058370048, "network": [{"ip": ["192.168.1.66"], "name": "eth0"}]}, "cpu_info": {"name": "Intel(R) Pentium(R) CPU G3260 @ 3.30GHz", "core_count": 2}, "mb_stat": {"sys_temp": 0, "memory_free": 2572922880, "disk_free": 54076716032}, "cpu_stat": {"temp": 0, "fan_percent": 0}, "add_power": 0, "gpu_drivers": "amdgpu"}, "fans": [], "mining_info": [{"coin_id": 1, "coin_name": "ETH", "coin_algo": "ethash", "is_nicehash": 0, "miner_id": 771, "miner_name": "Teamredminer 0.8.0", "wallet_name": "ETH|2miners|TRM080", "pool_id": 1065, "pool_name": "2miners"}]}
Необходимо пройтись по json и вернуть name, id, hashrate карт хэшрейт которых менее заданного мной значения.
def hash_notify():
data = get_worker_info()
for vc in json.loads(data)['mpu_list']:
if vc['hashrate'] < 53350000:
return vc['id', 'name', 'hashrate']
print(hash_notify())
На данный момент получаю ошибку:
in loads
raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not dict
Из-за скудного знания python не знаю как это обыграть. Помогите плз.