aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/evergreen/stackoverflow.py
diff options
context:
space:
mode:
Diffstat (limited to 'bot/exts/evergreen/stackoverflow.py')
-rw-r--r--bot/exts/evergreen/stackoverflow.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/bot/exts/evergreen/stackoverflow.py b/bot/exts/evergreen/stackoverflow.py
index 45dcb62a..8607cac7 100644
--- a/bot/exts/evergreen/stackoverflow.py
+++ b/bot/exts/evergreen/stackoverflow.py
@@ -34,14 +34,11 @@ class Stackoverflow(commands.Cog):
"""Sends the top 5 results of a search query from stackoverflow."""
encoded_search_query = quote_plus(search_query)
- for _ in range(3):
- async with self.bot.http_session.get(BASE_URL.format(query=encoded_search_query)) as response:
- if response.status == 200:
- data = await response.json()
- break
- else:
- logger.error(f'Status code is not 200, it is {response.status}')
- continue
+ async with self.bot.http_session.get(BASE_URL.format(query=encoded_search_query)) as response:
+ if response.status == 200:
+ data = await response.json()
+ else:
+ logger.error(f'Status code is not 200, it is {response.status}')
if response.status != 200: # If the status is still not 200 after the 3 tries
await ctx.send(embed=ERR_EMBED)
return