我試圖從獲得關注者串列中該組態檔,我試圖使使用Python要求使用這個API GET請求URL請求,但它似乎沒有作業,我得到了METHOD_NOT_ALLOWED錯誤。這是我的代碼:
import requests
address = '0xe744d23107c9c98df5311ff8c1c8637ec3ecf9f3'
followerurl = 'https://api-mainnet.rarible.com/marketplace/api/v4/followers?owner={}'.format(address)
data = requests.get(followerurl)
print(data.content)
我得到的錯誤:
{"timestamp":"2021-11-03T20:00:52.178 00:00","path":"/marketplace/api/v4/followers","status":405,"error":"Method Not Allowed","message":"","requestId":"1196e350-7513428"}'
我將不勝感激有關如何獲得我需要的實際關注者串列的任何幫助,謝謝
uj5u.com熱心網友回復:
這意味著您不能GET對頁面使用方法。嘗試類似:
data = requests.post(followerurl, data="")
print(data.content)
uj5u.com熱心網友回復:
嘗試這個:
import time
import requests
link = 'https://api-mainnet.rarible.com/marketplace/api/v4/followers'
params = {'user': '0xe744d23107c9c98df5311ff8c1c8637ec3ecf9f3'}
payload = {"size": 20}
with requests.Session() as s:
s.headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36'
res = s.post(link,params=params,json=payload)
for item in res.json():
print(item['owner']['name'])
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/346794.html
