I am trying to get the followers list from this profile, I tried making a GET request using python requests to the API using this request URL but it didn't seem to work, I got a METHOD_NOT_ALLOWED error. Here is my code:
import requests
address = '0xe744d23107c9c98df5311ff8c1c8637ec3ecf9f3'
followerurl = 'https://api-mainnet.rarible.com/marketplace/api/v4/followers?owner={}'.format(address)
data = requests.get(followerurl)
print(data.content)
The error I got:
{"timestamp":"2021-11-03T20:00:52.178 00:00","path":"/marketplace/api/v4/followers","status":405,"error":"Method Not Allowed","message":"","requestId":"1196e350-7513428"}'
I would appreciate any help on how to get the actual followers list I need, thank you
CodePudding user response:
Try this:
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'])
CodePudding user response:
That means you cannot use GET
method for the page. Try something like:
data = requests.post(followerurl, data="")
print(data.content)