mirror of
https://github.com/boticord/boticordpy.git
synced 2024-11-11 19:07:29 +03:00
add headers
This commit is contained in:
parent
0b0182fe7f
commit
aca61cbdc7
3 changed files with 17 additions and 7 deletions
|
@ -41,7 +41,8 @@ class Bots:
|
||||||
botID : :class:`int`
|
botID : :class:`int`
|
||||||
Discord Bot's ID
|
Discord Bot's ID
|
||||||
"""
|
"""
|
||||||
headers = {}
|
headers = {"Authorization": self.token}
|
||||||
|
|
||||||
async with self.session.get(f'{Config.general_api}/bot/{botID}', headers=headers) as resp:
|
async with self.session.get(f'{Config.general_api}/bot/{botID}', headers=headers) as resp:
|
||||||
data = await _json_or_text(resp)
|
data = await _json_or_text(resp)
|
||||||
status = Config.http_exceptions.get(resp.status)
|
status = Config.http_exceptions.get(resp.status)
|
||||||
|
@ -58,7 +59,8 @@ class Bots:
|
||||||
botID : :class:`int`
|
botID : :class:`int`
|
||||||
Discord Bot's ID
|
Discord Bot's ID
|
||||||
"""
|
"""
|
||||||
headers = {}
|
headers = {"Authorization": self.token}
|
||||||
|
|
||||||
async with self.session.get(f'{Config.general_api}/bot/{botID}/comments', headers=headers) as resp:
|
async with self.session.get(f'{Config.general_api}/bot/{botID}/comments', headers=headers) as resp:
|
||||||
data = await _json_or_text(resp)
|
data = await _json_or_text(resp)
|
||||||
status = Config.http_exceptions.get(resp.status)
|
status = Config.http_exceptions.get(resp.status)
|
||||||
|
@ -77,7 +79,9 @@ class Bots:
|
||||||
"""
|
"""
|
||||||
if not self.token:
|
if not self.token:
|
||||||
return "Require Authentication"
|
return "Require Authentication"
|
||||||
|
|
||||||
headers = {"Authorization": self.token}
|
headers = {"Authorization": self.token}
|
||||||
|
|
||||||
async with self.session.post(f'{Config.general_api}/stats', headers=headers, json=stats) as resp:
|
async with self.session.post(f'{Config.general_api}/stats', headers=headers, json=stats) as resp:
|
||||||
data = await _json_or_text(resp)
|
data = await _json_or_text(resp)
|
||||||
status = Config.http_exceptions.get(resp.status)
|
status = Config.http_exceptions.get(resp.status)
|
||||||
|
|
|
@ -42,7 +42,8 @@ class Servers:
|
||||||
serverID : :class:`int`
|
serverID : :class:`int`
|
||||||
Discord Server's ID
|
Discord Server's ID
|
||||||
"""
|
"""
|
||||||
headers = {}
|
headers = {"Authorization": self.token}
|
||||||
|
|
||||||
async with self.session.get(f'{Config.general_api}/server/{serverID}', headers=headers) as resp:
|
async with self.session.get(f'{Config.general_api}/server/{serverID}', headers=headers) as resp:
|
||||||
data = await _json_or_text(resp)
|
data = await _json_or_text(resp)
|
||||||
status = Config.http_exceptions.get(resp.status)
|
status = Config.http_exceptions.get(resp.status)
|
||||||
|
@ -59,7 +60,8 @@ class Servers:
|
||||||
serverID : :class:`int`
|
serverID : :class:`int`
|
||||||
Discord Server's ID
|
Discord Server's ID
|
||||||
"""
|
"""
|
||||||
headers = {}
|
headers = {"Authorization": self.token}
|
||||||
|
|
||||||
async with self.session.get(f'{Config.general_api}/server/{serverID}/comments', headers=headers) as resp:
|
async with self.session.get(f'{Config.general_api}/server/{serverID}/comments', headers=headers) as resp:
|
||||||
data = await _json_or_text(resp)
|
data = await _json_or_text(resp)
|
||||||
status = Config.http_exceptions.get(resp.status)
|
status = Config.http_exceptions.get(resp.status)
|
||||||
|
@ -100,6 +102,7 @@ class Servers:
|
||||||
stats = custom_stats
|
stats = custom_stats
|
||||||
|
|
||||||
headers = {"Authorization": self.token}
|
headers = {"Authorization": self.token}
|
||||||
|
|
||||||
async with self.session.post(f'{Config.general_api}/server', headers=headers, json=stats) as resp:
|
async with self.session.post(f'{Config.general_api}/server', headers=headers, json=stats) as resp:
|
||||||
data = await _json_or_text(resp)
|
data = await _json_or_text(resp)
|
||||||
status = Config.http_exceptions.get(resp.status)
|
status = Config.http_exceptions.get(resp.status)
|
||||||
|
|
|
@ -35,7 +35,8 @@ class Users:
|
||||||
userID : :class:`int`
|
userID : :class:`int`
|
||||||
Discord User's ID
|
Discord User's ID
|
||||||
"""
|
"""
|
||||||
headers = {}
|
headers = {"Authorization": self.token}
|
||||||
|
|
||||||
async with self.session.get(f'{Config.general_api}/profile/{userID}', headers=headers) as resp:
|
async with self.session.get(f'{Config.general_api}/profile/{userID}', headers=headers) as resp:
|
||||||
data = await _json_or_text(resp)
|
data = await _json_or_text(resp)
|
||||||
status = Config.http_exceptions.get(resp.status)
|
status = Config.http_exceptions.get(resp.status)
|
||||||
|
@ -52,7 +53,8 @@ class Users:
|
||||||
userID : :class:`int`
|
userID : :class:`int`
|
||||||
Discord User's ID
|
Discord User's ID
|
||||||
"""
|
"""
|
||||||
headers = {}
|
headers = {"Authorization": self.token}
|
||||||
|
|
||||||
async with self.session.get(f'{Config.general_api}/profile/{userID}/comments', headers=headers) as resp:
|
async with self.session.get(f'{Config.general_api}/profile/{userID}/comments', headers=headers) as resp:
|
||||||
data = await _json_or_text(resp)
|
data = await _json_or_text(resp)
|
||||||
status = Config.http_exceptions.get(resp.status)
|
status = Config.http_exceptions.get(resp.status)
|
||||||
|
@ -69,7 +71,8 @@ class Users:
|
||||||
userID : :class:`int`
|
userID : :class:`int`
|
||||||
Discord User's ID
|
Discord User's ID
|
||||||
"""
|
"""
|
||||||
headers = {}
|
headers = {"Authorization": self.token}
|
||||||
|
|
||||||
async with self.session.get(f'{Config.general_api}/bots/{userID}', headers=headers) as resp:
|
async with self.session.get(f'{Config.general_api}/bots/{userID}', headers=headers) as resp:
|
||||||
data = await _json_or_text(resp)
|
data = await _json_or_text(resp)
|
||||||
status = Config.http_exceptions.get(resp.status)
|
status = Config.http_exceptions.get(resp.status)
|
||||||
|
|
Loading…
Reference in a new issue