mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-13 22:40:16 +02:00
correct user deletion headers
This commit is contained in:
parent
769357453a
commit
54731d4aea
@ -483,7 +483,6 @@ class DiscordOAuthManager:
|
|||||||
def add_user(code):
|
def add_user(code):
|
||||||
try:
|
try:
|
||||||
token = DiscordOAuthManager._process_callback_code(code)['access_token']
|
token = DiscordOAuthManager._process_callback_code(code)['access_token']
|
||||||
logger.debug(token)
|
|
||||||
logger.debug("Received token from OAuth")
|
logger.debug("Received token from OAuth")
|
||||||
|
|
||||||
custom_headers = {'accept': 'application/json', 'authorization': 'Bearer ' + token}
|
custom_headers = {'accept': 'application/json', 'authorization': 'Bearer ' + token}
|
||||||
@ -507,7 +506,7 @@ class DiscordOAuthManager:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def delete_user(user_id):
|
def delete_user(user_id):
|
||||||
try:
|
try:
|
||||||
custom_headers = {'accept': 'application/json', 'authorization': 'Bearer ' + settings.DISCORD_BOT_TOKEN}
|
custom_headers = {'accept': 'application/json', 'authorization': settings.DISCORD_BOT_TOKEN}
|
||||||
path = DISCORD_URL + "/guilds/" + str(settings.DISCORD_GUILD_ID) + "/members/" + str(user_id)
|
path = DISCORD_URL + "/guilds/" + str(settings.DISCORD_GUILD_ID) + "/members/" + str(user_id)
|
||||||
r = requests.delete(path, headers=custom_headers)
|
r = requests.delete(path, headers=custom_headers)
|
||||||
logger.debug("Got status code %s after removing Discord user ID %s" % (r.status_code, user_id))
|
logger.debug("Got status code %s after removing Discord user ID %s" % (r.status_code, user_id))
|
||||||
@ -517,7 +516,7 @@ class DiscordOAuthManager:
|
|||||||
logger.exception("Failed to remove Discord user %s" % user_id)
|
logger.exception("Failed to remove Discord user %s" % user_id)
|
||||||
try:
|
try:
|
||||||
# user maybe already left server?
|
# user maybe already left server?
|
||||||
custom_headers = {'accept': 'application/json', 'authorization': 'Bearer ' + settings.DISCORD_BOT_TOKEN}
|
custom_headers = {'accept': 'application/json', 'authorization': settings.DISCORD_BOT_TOKEN}
|
||||||
path = DISCORD_URL + "/guilds/" + str(settings.DISCORD_GUILD_ID) + "/members/"
|
path = DISCORD_URL + "/guilds/" + str(settings.DISCORD_GUILD_ID) + "/members/"
|
||||||
r = requests.get(path, headers=custom_headers)
|
r = requests.get(path, headers=custom_headers)
|
||||||
members = r.json()
|
members = r.json()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user