From 03b90e444ed18b88aed710371309c271c25ac391 Mon Sep 17 00:00:00 2001 From: Guilherme Ruiz <57478888+guigoruiz1@users.noreply.github.com> Date: Thu, 30 Nov 2023 18:07:32 +0000 Subject: [PATCH] Using correct user agent --- tqdm/contrib/discord.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tqdm/contrib/discord.py b/tqdm/contrib/discord.py index d4572e67..56f7d853 100644 --- a/tqdm/contrib/discord.py +++ b/tqdm/contrib/discord.py @@ -8,7 +8,7 @@ from ..std import TqdmWarning from .utils_worker import MonoWorker from ..version import __version__ -__author__ = {"github.com/": ["casperdcl"]} +__author__ = {"github.com/": ["casperdcl","guigoruiz1"]} __all__ = ["DiscordIO", "tqdm_discord", "tdrange", "tqdm", "trange"] @@ -16,6 +16,7 @@ class DiscordIO(MonoWorker): """Non-blocking file-like IO using a Discord Bot.""" API = "https://discord.com/api/v10" + user_agent = f"TQDM Discord progress bar (https://tqdm.github.io, {__version__})" def __init__(self, token, channel_id): """Creates a new message in the given `channel_id`.""" @@ -32,7 +33,7 @@ class DiscordIO(MonoWorker): try: headers = { "Authorization": f"Bot {self.token}", - "User-Agent": f"TQDM Discord progress bar (http://github.com/tqdm/tqdm, {__version__})", + "User-Agent": self.user_agent, } data = {"content": "`" + self.text + "`"} res = requests.post( @@ -61,7 +62,7 @@ class DiscordIO(MonoWorker): try: headers = { "Authorization": f"Bot {self.token}", - "User-Agent": f"TQDM Discord progress bar (http://github.com/tqdm/tqdm, {__version__})", + "User-Agent": self.user_agent, } data = {"content": "`" + s + "`"} future = self.submit( @@ -80,7 +81,7 @@ class DiscordIO(MonoWorker): try: headers = { "Authorization": f"Bot {self.token}", - "User-Agent": f"TQDM Discord progress bar (http://github.com/tqdm/tqdm, {__version__})", + "User-Agent": self.user_agent, } future = self.submit( requests.delete,