From 409fe6828321bfb9f337758e347603227085afec Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 18 Aug 2024 22:57:57 +0300 Subject: [PATCH] Refactor(Robots/base): Simplify `X-User-Agent` --- Robots/base.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Robots/base.py b/Robots/base.py index a504e47..c63504b 100644 --- a/Robots/base.py +++ b/Robots/base.py @@ -35,7 +35,7 @@ request_headers = { 'Referer': '/', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:120.0) ' 'Gecko/20100101 Firefox/120.0', - 'X-User-Agent': 'bookmarks_db %s (Python %d.%d.%d)' % ( + 'X-User-Agent': 'bookmarks_db %s (Python %d.%d.%d) ' % ( __version__, *sys.version_info[:3]), } @@ -87,9 +87,7 @@ class robot_base(Robot): setattr(self, attr, value) Robot.__init__(self, *args, **kw) socket.setdefaulttimeout(self.timeout) - - request_headers['X-User-Agent'] = '%s %s' % ( - request_headers['X-User-Agent'], self.version_str()) + request_headers['X-User-Agent'] += self.version_str() def version_str(self): return self.__class__.__name__ -- 2.39.5