Home > Back-end >  I am trying to list all guild members with python requests but I am getting an error: {'message
I am trying to list all guild members with python requests but I am getting an error: {'message

Time:10-15

I'm trying to get user list from my guild using python requests but I'm getting an error. I was able to read and send messages with this usage of auth token and api so I'm confused. Here is my code:

import requests
import json
import hide

header = {
    'authorization': hide.authorization
}

url = 'https://discord.com/api/v9/guilds/{}/members'

_data = requests.get(url.format(hide.guild_id),headers=header)
data = _data.json()
print(_data)
print(data)

My output

<Response [403]>
{'message': 'Missing Access', 'code': 50001}

CodePudding user response:

The response code 403 means:

The HTTP 403 Forbidden response status code indicates that the server understands the request but refuses to authorize it.

This status is similar to 401, but for the 403 Forbidden status code re-authenticating makes no difference. The access is permanently forbidden and tied to the application logic, such as insufficient rights to a resource.

You probably haven't inserted the expected header name or header value. Probably the value.

CodePudding user response:

I searched a little more and I found out that what I am trying to make is restricted so thanks for your answers. You can check it here: https://discord.com/developers/docs/topics/gateway#privileged-intents

  • Related