Corrected an indentation error
This commit is contained in:
parent
e62589e78c
commit
ae406a736d
1 changed files with 17 additions and 17 deletions
|
@ -26,26 +26,26 @@ class Overwatch:
|
||||||
self.headers = {"User-Agent": config.user_agent}
|
self.headers = {"User-Agent": config.user_agent}
|
||||||
self.session = aiohttp.ClientSession()
|
self.session = aiohttp.ClientSession()
|
||||||
|
|
||||||
async def _request(self, payload, endpoint):
|
async def _request(self, payload, endpoint):
|
||||||
"""Handles requesting to the API"""
|
"""Handles requesting to the API"""
|
||||||
|
|
||||||
# Format the URL we'll need based on the base_url, and the endpoint we want to hit
|
# Format the URL we'll need based on the base_url, and the endpoint we want to hit
|
||||||
url = "{}{}".format(base_url, endpoint)
|
url = "{}{}".format(base_url, endpoint)
|
||||||
|
|
||||||
# Attempt to connect up to our max retries
|
# Attempt to connect up to our max retries
|
||||||
for x in range(MAX_RETRIES):
|
for x in range(MAX_RETRIES):
|
||||||
try:
|
try:
|
||||||
async with aiohttp.ClientSession(headers=self.headers) as session:
|
async with aiohttp.ClientSession(headers=self.headers) as session:
|
||||||
async with session.get(url, params=payload) as r:
|
async with session.get(url, params=payload) as r:
|
||||||
# If we failed to connect, attempt again
|
# If we failed to connect, attempt again
|
||||||
if r.status != 200:
|
if r.status != 200:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
data = await r.json()
|
data = await r.json()
|
||||||
return data
|
return data
|
||||||
# If any error happened when making the request, attempt again
|
# If any error happened when making the request, attempt again
|
||||||
except:
|
except:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@commands.group(no_pm=True)
|
@commands.group(no_pm=True)
|
||||||
async def ow(self):
|
async def ow(self):
|
||||||
|
|
Loading…
Reference in a new issue