2 回答

TA贡献1780条经验 获得超5个赞
因为 coinmarketcap.com 上的 v1 API 现在已弃用、关闭,并在每个请求上返回。{'statusCode': 404, 'error': 'Not Found', 'message': 'Not Found'}

TA贡献1111条经验 获得超0个赞
此 API 如上所述进行折旧,运行以下代码,返回的字典声明相同的内容。
{'statusCode': 410, 'error': 'Gone', 'message': 'WARNING: This API is now offline. Please switch to the new CoinMarketCap API. (https://pro.coinmarketcap.com/migrate/)'}
import requests
import json
TICKER_API_URL = 'https://api.coinmarketcap.com/v1/ticker/'
def get_latest_crypto_price(crypto):
response = requests.get(TICKER_API_URL+crypto)
response_json = response.json()
return response_json
price = get_latest_crypto_price('bitcoin')
print(price)
添加回答
举报