有一个通过 API 发送请求的异步函数。我需要检查一个空响应,但由于某种原因它print(html_3['items'] is None)
说False
,虽然响应是空的。问题是什么?
...
async with session.get(f'https://market.csgo.com/api/v2/my-inventory/?key={profiles_dict[1][1]}') as resp_3:
html_3 = await resp_3.json()
print(html_3['items'])
print(html_3['items'] is None)
...
回答:
[]
False
[]
False
[]
False
[]
False
[]
False
[]
False
[]
False
[{'id': '23354298822', 'classid': '310777025', 'instanceid': '0', 'market_hash_name': 'Dual Berettas | Colony (Minimal Wear)', 'market_price': 0.69, 'tradable': 1}]
False
[]
False
[]
False
[]
False
Process finished with exit code -1
做