I am trying to list all guild members with python requests but I am getting an error: {'message': 'Missing Access', 'code': 50001}
Question:
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}
Answers:
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.
To test it check the output of:
print(hide.authorization)
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}
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.
To test it check the output of:
print(hide.authorization)