aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Shivansh-007 <[email protected]>2021-02-08 05:51:14 +0530
committerGravatar Shivansh-007 <[email protected]>2021-02-08 05:51:14 +0530
commit3242cc6c1dba0a0ecf3b5c0cdf5b90a4784dbfd1 (patch)
tree50feb94596e94390fb64f89cb9f4c313fd3b2929
parentMerge pull request #572 from Shivansh-007/feature/cheat.sh (diff)
Add curl User Agent Headers
-rw-r--r--bot/exts/evergreen/cheatsheet.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/bot/exts/evergreen/cheatsheet.py b/bot/exts/evergreen/cheatsheet.py
index 97485365..f6dce995 100644
--- a/bot/exts/evergreen/cheatsheet.py
+++ b/bot/exts/evergreen/cheatsheet.py
@@ -26,6 +26,7 @@ If the problem persists send a message in <#{Channels.dev_contrib}>
URL = 'https://cheat.sh/python/{search}'
ESCAPE_TT = str.maketrans({"`": "\\`"})
ANSI_RE = re.compile(r"\x1b\[.*?m")
+HEADERS = {'User-Agent': 'curl/7.68.0'}
class CheatSheet(commands.Cog):
@@ -92,7 +93,7 @@ class CheatSheet(commands.Cog):
search_string = quote_plus(" ".join(search_terms))
async with self.bot.http_session.get(
- URL.format(search=search_string)
+ URL.format(search=search_string), headers=HEADERS
) as response:
result = ANSI_RE.sub("", await response.text()).translate(ESCAPE_TT)