所以我试图使用请求包能够做到这个简单的端点,但我没有检索适当的json我正在寻找。下面是我的代码。
import requests
api_url = "https://vfat.tools/aurora/auroraswap/"
response = requests.get(api_url)
response.json()
我没有得到我想要端点能够集成正确响应的json。
这是我得到的,当我运行python脚本,它不是json,有几个错误,这让我认为我没有这样做正确:
这是我得到的关于运行python脚本。
Traceback (most recent call last):
File "/Library/Python/3.8/site-packages/requests/models.py", line 910, in json
return complexjson.loads(self.text, **kwargs)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "multifarm_endpoint.py", line 5, in <module>
response.json()
File "/Library/Python/3.8/site-packages/requests/models.py", line 917, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: [Errno Expecting value] <!DOCTYPE html> <html lang=en> <head> <meta charset=UTF-8> <!-- Primary Meta Tags --> <title>Yield Farming Info</title> <meta name=title content="Yield Farming Info"> <meta name=description content="🧑‍🌾 It ain't much, but it's honest work"> <!-- Open Graph / Facebook --> <meta property=og:type content=website> <meta property=og:url content=https://vfat.tools/ > <meta property=og:title content="Yield Farming Info"> <meta property=og:description content="🧑‍🌾 It ain't much, but it's honest work"> <meta property=og:image content=https://yieldfarming.info/img/thumbnail.png> <!-- Twitter --> <meta property=twitter:card content=summary_large_image> <meta property=twitter:url content=https://vfat.tools/ > <meta property=twitter:title content="Yield Farming Info"> <meta property=twitter:description content="🧑‍🌾 It ain't much, but it's honest work"> <meta property=twitter:image content=https://yieldfarming.info/img/thumbnail.png> <link rel=stylesheet href=/css/index.abdd5e2b77d7e79a2729beb9d2ba16e0.css> <link rel=preload href=/js/vendor.c8623390013927ce9b57ef73c7496130.js as=script> <link rel=prefetch href=/js/vendor.c8623390013927ce9b57ef73c7496130.js> <link rel=preload href=/js/app.3e3ef23ced4a0f316d85b7b82847c912.js as=script> <link rel=prefetch href=/js/app.3e3ef23ced4a0f316d85b7b82847c912.js> <meta name=theme-color content=#ffffff> <meta name=viewport content="width=device-width,initial-scale=1"> <link rel=icon href=/favicon.svg> <link rel=apple-touch-icon href=/apple-touch-icon.png> <link rel=manifest href=/manifest.json> </head> <div id=quick class=modal> <form class=modal-content id=quick-form> <input autocomplete=off id=quick-input class=modal-input> <ul id=quick-dropdown></ul> </form> </div> <div id=pool-details-modal class=modal> <div class=modal-content id=pool-details> <a href=# class=modal-close id=close-pool-details-modal>Close</a><br> <pre id=pool-details-content></pre> </div> </div> <script> document
.getElementById("close-pool-details-modal")
.onclick = () => {
document.getElementById("pool-details-modal").style.display = 'none'
document.getElementById("pool-details-content").innerHTML = ''
} </script> <body> <div> <a href=/ >Home</a> - <a href=/mcn/ >MCN</a> - <a href=/all/ >All</a> - <a href=/bsc/ >BSC</a> - <a href=/arbitrum/ >ARBITRUM</a> - <a href=/heco/ >HECO</a> - <a href=/polygon/ >POLYGON</a> - <a href=/gnosis/ >GNOSIS</a> - <a href=/avax/ >AVAX</a> - <a href=/fantom/ >FANTOM</a> - <a href=/harmony/ >HARMONY</a> - <a href=/fuse/ >FUSE</a> - <a href=/thundercore/ >ThunderCore</a> - <a href=/okex/ >OKEX</a> - <a href=/kcc/ >KUCOIN</a> - <a href=/celo/ >CELO</a> - <a href=/iotex/ >IoTeX</a> - <a href=/moonriver/ >Moonriver</a> - <a href=/optimism/ >Optimism</a> - <a href=/smartbch/ >SmartBCH</a> - <a href=/polis/ >Polis</a> - <a href=/cronos/ >Cronos</a> - <a href=/velas/ >Velas</a> - <a href=/aurora/ >Aurora</a> - <a href=/boba/ >Boba</a> - <a href=/metis/ >Metis</a> - <a href=/meter/ >Meter</a> - <a href=/emerald/ >Emerald</a> - <a href=/moonbeam/ >Moonbeam</a> - <a href=/telos/ >Telos</a> - <a href=/dfk/ >DFK</a> - <a href=/astar/ >Astar</a> - <a href=/milkomeda/ >Milkomeda</a> - <a href=/evmos/ >EVMOS</a> - <a href=/hoo/ >Hoo</a> - <a href=/seigniorage/ >Seigniorage</a> </div> <div id=quick class=modal> <form class=modal-content id=quick-form> <input autocomplete=off id=quick-input class=modal-input> <ul id=quick-dropdown></ul> </form> </div> <div id=pool-details-modal class=modal> <div class=modal-content id=pool-details> <a href=# class=modal-close id=close-pool-details-modal>Close</a><br> <pre id=pool-details-content></pre> </div> </div> <script> document
.getElementById("close-pool-details-modal")
.onclick = () => {
document.getElementById("pool-details-modal").style.display = 'none'
document.getElementById("pool-details-content").innerHTML = ''
} </script> <br> <a href=https://discord.gg/vfat target=_blank>*** Discord ***</a> <a href="" id=theme-button>[light mode]</a> <script> function setDarkMode() {
document.documentElement.setAttribute('data-theme', 'dark');
localStorage.setItem('theme', 'dark');
document.getElementById("theme-button").innerText = '[light mode]';
}
function setLightMode() {
document.documentElement.setAttribute('data-theme', 'light');
localStorage.setItem('theme', 'light');
document.getElementById("theme-button").innerText = '[dark mode]';
}
function initTheme() {
let currentTheme = localStorage.getItem('theme');
if (currentTheme === "dark") {
setDarkMode();
} else {
setLightMode();
}
}
function setTheme() {
let currentTheme = localStorage.getItem('theme');
if (currentTheme === "dark") {
setLightMode();
} else {
setDarkMode();
}
}
initTheme();
document.getElementById("theme-button").onclick = setTheme </script> <pre id=log>*************** ð¨âð¾ UNOFFICIAL AURORASWAP.FINANCE FARMING CALCULATOR ð¨âð¾ ***************
INFO : https://app.auroraswap.finance
***************************************************************************************
</pre> <div class=loader--1></div> <script src=/js/vendor.c8623390013927ce9b57ef73c7496130.js></script> <script src=/js/app.3e3ef23ced4a0f316d85b7b82847c912.js></script> <script src=/js/data.609946ce4705561f1bf29784d130e46b.js></script> <script src=/js/dollars.9d2af9cbbbad251adb5e787b21a6256e.js></script> <script src=/js/ethers_helper.0f59f60bc7bacb5abea6b997f2ceca3e.js></script> <script src=/js/dollar_helper.97adbbd9237cfa544e79319b86c98a01.js></script> <script src=/js/bsc_helpers.16d9433e66510c14b62b427aa38cf6da.js></script> <script src=/js/arbitrum_helpers.cab88a4057d56b54b1a7b99cb227f2d4.js></script> <script src=/js/heco_helpers.aa62399a0e303500b7ab922f77204e57.js></script> <script src=/js/matic_helpers.77288a7ba0b1f0d2d51685ad58146ebb.js></script> <script src=/js/avax_helpers.3b7a9df101d0be9bd6c3716ecba4c220.js></script> <script src=/js/gnosis_helpers.92bdaa29435cabf7f2dc22a4242ef7c8.js></script> <script src=/js/fantom_helpers.f16e8734cee137d249e50f99a5532363.js></script> <script src=/js/harmony_helpers.8716ed178dd5747bcae81b97d76b4dec.js></script> <script src=/js/fuse_helpers.789415be4b1b1d34adcf3666c1db5792.js></script> <script src=/js/pool_table_helpers.ddb10b00ee8de085eb2a7b393ca79310.js></script> <script src=/js/thundercore_helpers.124f57b1c6f1e4013513ecac6a1975d4.js></script> <script src=/js/kyber_helpers.2725a5eb901fbeef494819b02d80e8df.js></script> <script src=/js/kcc_helpers.3dc0dffde4936b4b1b0e421b5b195760.js></script> <script src=/js/celo_helpers.75e0b984850392c138cf572d49f23fc9.js></script> <script src=/js/iotex_helpers.6b054744a02534531e94485e5d47376b.js></script> <script src=/js/moonriver_helpers.653649824d314291d70f41d96e0492ca.js></script> <script src=/js/optimism_helpers.981a7cad0bae76030669bd0d7eec29bd.js></script> <script src=/js/smartbch_helpers.90dc6bd529760160f70d73c61afcfbea.js></script> <script src=/js/polis_helpers.50e36da5b3f54e3e2a4a52606159b46f.js></script> <script src=/js/cronos_helpers.ae12c904ce7a0053ee6a93c0036672b2.js></script> <script src=/js/velas_helpers.da7df15809bbeebabeb8f885c61673b8.js></script> <script src=/js/aurora_helpers.ef28410adf23b6f2bf9866f39edde5fc.js></script> <script src=/js/boba_helpers.ba39a1b9858ecc8ab1db5a2d3e43841f.js></script> <script src=/js/metis_helpers.0981b03938ececeb96cbb837707cd204.js></script> <script src=/js/meter_helpers.75b29551306c610b57b0dc3555a845d2.js></script> <script src=/js/emerald_helpers.ca4347657fe4b9d057d984ce22d2ca0e.js></script> <script src=/js/moonbeam_helpers.9f9a0e20946652e69c75d490c445d1d9.js></script> <script src=/js/telos_helpers.afc289fcfc5e6a35f150b9bde4d9407e.js></script> <script src=/js/dfk_helpers.dd75d59e085f8ddae5265ba75b780dd7.js></script> <script src=/js/milkomeda_helpers.d29e2dad693d679c93d3c202611489e0.js></script> <script src=/js/evmos_helpers.488e8c204658feb17c3948815ad61fcd.js></script> <script src=/js/general_helpers.273c3bda887b70222eecad433afcba1b.js></script> <script src=/js/prices.c82c76c7852bc074211da10d53d3bf04.js></script> <script src=/js/aurora_auroraswap.315835de5b747bded11d2604524e92cd.js></script> </body> </html> : 0
有什么帮助吗?我可以看看适当的资源,以正确理解如何获得没有API文档的端点?如有任何帮助,不胜感激。
请查看vfat存储库以及它们如何集成AuroraSwap:
vfat-tools/aurora_auroraswap.js at master·vfat-tools/vfat-tools (github.com)
请写一个简单的端点,返回给我该池(红色标记)的年APR:
(链接:Yield Farming Info (vfat.tools))
该URL不返回JSON -它是一个网页。如果有一个API,也许你的URL是错的?