From 853194bd7e035e8589df06bc442878ad2befe575 Mon Sep 17 00:00:00 2001 From: monosans Date: Thu, 7 Jul 2022 13:02:50 +0300 Subject: [PATCH] Add User-Agent header when fetching sources --- CHANGELOG.md | 4 ++++ main.py | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d1c001..ac46b85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # YYYY-MM-DD +## 2022-07-07 + +- Add `User-Agent` header when fetching sources. + ## 2022-06-16 - Edit uvloop marker. diff --git a/main.py b/main.py index 79217d2..5c3728d 100755 --- a/main.py +++ b/main.py @@ -255,7 +255,13 @@ class ProxyScraperChecker: ) for proto, sources in self.sources.items() } - async with ClientSession() as session: + headers = { + "User-Agent": ( + "Mozilla/5.0 (Windows NT 10.0; rv:102.0)" + + " Gecko/20100101 Firefox/102.0" + ) + } + async with ClientSession(headers=headers) as session: coroutines = ( self.fetch_source( session, source, proto, progress, tasks[proto]