-2

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

Netgate
  • 13
  • 3
  • Please don't post the same question twice... update your original question if anything. – Marco Bonelli Nov 03 '21 at 20:41
  • Does this answer your question? [Why does my python POST request fails to gather the info I want?](https://stackoverflow.com/questions/69830450/why-does-my-python-post-request-fails-to-gather-the-info-i-want) – Nullman Nov 03 '21 at 20:42
  • `requests.get('https://api-mainnet.rarible.com/marketplace/api/v4/followers', params={'owner': address})` – Olvin Roght Nov 03 '21 at 20:45

2 Answers2

0

That means you cannot use GET method for the page. Try something like:

data = requests.post(followerurl, data="")
print(data.content)
mrvol
  • 2,575
  • 18
  • 21
  • [I think they already tried...](https://stackoverflow.com/questions/69830450/why-does-my-python-post-request-fails-to-gather-the-info-i-want) – Marco Bonelli Nov 03 '21 at 20:40
  • @MarcoBonelli :-) This way of self-studying gonna be very hard by asking questions on SO... – mrvol Nov 03 '21 at 20:42
  • @mrvol I'm fairly new to web-scraping and the requests library, I am trying to learn as much as I can and I believe asking for advice from people more experienced than me is a great way :) – Netgate Nov 03 '21 at 20:47
  • @netgate why don't you start with googling? https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405 – mrvol Nov 03 '21 at 20:49
-1

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'])
SIM
  • 21,997
  • 5
  • 37
  • 109