所以我一直在创建一个python代码,该代码调用API以获取其JSON代码。
使用此代码请求 API 后:
url = requests.get("https://stats.foldingathome.org/api/donor/PointofHorizon")
然后,我将给定的 JSON 信息打印到控制台中以获取此输出:
{"wus": 131, "rank": 99964, "total_users": 2236318, "active_50": 2, "path": "donor/PointofHorizon", "wus_cert": "https://apps.foldingathome.org/awards?user=35025837&type=wus", "id": 35025837, "credit_cert": "https://apps.foldingathome.org/awards?user=35025837&type=score", "last": "2020-03-22 15:18:54", "name": "PointofHorizon", "teams": [{"wus": 97, "last": "2020-03-22 15:18:54", "uid": 35025837, "active_50": 2, "active_7": 2, "credit": 310435, "team": 225605, "name": "PC Master Race - PCMR"}, {"wus": 34, "last": "2019-08-17 13:00:11", "uid": 35025837, "active_50": 0, "active_7": 0, "credit": 431809, "team": 223518, "name": "LinusTechTips_Team"}], "active_7": 2, "credit": 742244}
这可以完美地在Windows机器上运行python代码,但是如果我在树莓派上运行这个确切的python代码,我会得到JSON,但它会完全随机化。请注意,窗口和 Pi 都运行完全相同的代码,而窗口给我的输出是我想要的,只是 pi 不是。任何人都可以解释为什么与窗口相比,我在Pi上获得随机输出?
以下是python代码在Windows和Pi上运行3次的一些屏幕截图,因此您可以理解我所说的随机含义。但基本上,它从 pi 上的 API 获取信息,而不是以 API 页面上的正确顺序显示 JSON 文件:
视窗: 编辑: 蟒蛇版本为这个视窗是蟒蛇 3.8.2
呼如林
慕勒3428872
相关分类