魔术伊甸园API仅在JSON响应中给出符号吗?

发布于 2025-01-22 13:22:44 字数 491 浏览 1 评论 0原文

我正在尝试通过Magic Eden API获取NFT系列的地板价格。我正在使用Python请求 -
API的文档提供此示例代码:

import requests

url = "http://api-mainnet.magiceden.dev/v2/collections/DeGods/stats"

payload = {}
headers = {}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

除了URL具有“可符号”,而不是“ DEGOD”。

这些文档在JSON对象中提供了“符号”,“ floorprice”,“ floorprice”,“ floorprice”,“ listedCount”和“ bolumeall”的响应 - 但是,无论我尝试哪种集合,它都只能在响应中给我符号。

没有示例标题或有效载荷。

I'm trying to get floor price of an NFT collection via the Magic Eden API. I'm using python requests -
The docs for the API provide this sample code:

import requests

url = "http://api-mainnet.magiceden.dev/v2/collections/DeGods/stats"

payload = {}
headers = {}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

except the url has "runcible" instead of "DeGods".

The docs give and example response with "symbol", "floorprice", "listedCount" and "volumeAll" in the JSON object - however, no matter what collection I try it only gives me the symbol in the response.

There was no examples headers or payload.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

盗琴音 2025-01-29 13:22:44

集合的象征是小写的集合的名称,其空间被下划线取代。尝试http://api-mainnet.magiceden.dev/v2/collections/degods/stats,它将起作用。

您的代码应该看起来像这样:

import requests

symbol = "DeGods"

url = "http://api-mainnet.magiceden.dev/v2/collections/{symbol}/stats".format(symbol=symbol.lower().replace(" ", "_"))

payload = {}
headers = {}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

使用上述代码,请尝试另一个集合。例如catalina鲸鱼混合器

这是简化的,它捕获了大多数收藏。其他人则需要一种更加精确的方法,这些方法太过多样化,我不能在这个答案中介绍。

作为一个提示,可以从收藏页的链接中推导出魔术伊甸园的象征。

例如,Grim Syndicate集合的链接是https://magiceden.io/marketplace/grim_syndicate。链接的最后一段是符号名称。

The symbol of a collection is the name of the collection in lowercase, with spaces replaced with an underscore. Try with http://api-mainnet.magiceden.dev/v2/collections/degods/stats and it will work.

Your code should look like this:

import requests

symbol = "DeGods"

url = "http://api-mainnet.magiceden.dev/v2/collections/{symbol}/stats".format(symbol=symbol.lower().replace(" ", "_"))

payload = {}
headers = {}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

With the above code, try another collection. E.g.The Catalina Whale Mixer.

That's a simplification, and it captures most of the collections. Others need a more precise approach that are too varied, and I can't go into in this answer.

As a hint, The symbol of a Magic Eden collection can be deduced from the link of the collections page.

For example, the link for the Grim Syndicate collection is https://magiceden.io/marketplace/grim_syndicate. The last segment of the link is the symbol name.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文