mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-25 22:47:04 +01:00
Stringify booleans discordrest redis
This commit is contained in:
parent
790dca1766
commit
bb10944052
@ -22,7 +22,7 @@ class DiscordREST:
|
|||||||
|
|
||||||
def init_discordrest(self):
|
def init_discordrest(self):
|
||||||
if not self._bucket_contains("global_limited"):
|
if not self._bucket_contains("global_limited"):
|
||||||
self._set_bucket("global_limited", False)
|
self._set_bucket("global_limited", "False")
|
||||||
self._set_bucket("global_limit_expire", 0)
|
self._set_bucket("global_limit_expire", 0)
|
||||||
|
|
||||||
def _get_bucket(self, key):
|
def _get_bucket(self, key):
|
||||||
@ -76,7 +76,7 @@ class DiscordREST:
|
|||||||
self._set_bucket(url, int(req.headers['X-RateLimit-Reset']))
|
self._set_bucket(url, int(req.headers['X-RateLimit-Reset']))
|
||||||
|
|
||||||
if 300 > req.status_code >= 200:
|
if 300 > req.status_code >= 200:
|
||||||
self._set_bucket("global_limited", False)
|
self._set_bucket("global_limited", "False")
|
||||||
return {
|
return {
|
||||||
'success': True,
|
'success': True,
|
||||||
'content': json_or_text(req),
|
'content': json_or_text(req),
|
||||||
@ -87,7 +87,7 @@ class DiscordREST:
|
|||||||
if 'X-RateLimit-Global' not in req.headers:
|
if 'X-RateLimit-Global' not in req.headers:
|
||||||
self._set_bucket(url, int(req.headers['X-RateLimit-Reset']))
|
self._set_bucket(url, int(req.headers['X-RateLimit-Reset']))
|
||||||
else:
|
else:
|
||||||
self._set_bucket("global_limited", True)
|
self._set_bucket("global_limited", "True")
|
||||||
self._set_bucket("global_limit_expire", time.time() + int(req.headers['Retry-After']))
|
self._set_bucket("global_limit_expire", time.time() + int(req.headers['Retry-After']))
|
||||||
|
|
||||||
if req.status_code == 502 and tries <= 5:
|
if req.status_code == 502 and tries <= 5:
|
||||||
|
Loading…
Reference in New Issue
Block a user