feat: add timeouts to all requests requests

This commit is contained in:
Iain Learmonth 2023-03-12 12:28:29 +00:00
parent 2498f408c8
commit fff38fa994
7 changed files with 10 additions and 7 deletions

View file

@ -14,7 +14,8 @@ class BlockBridgeScriptzteamAutomation(BlockBridgelinesAutomation):
def fetch(self) -> None:
r = requests.get(
"https://raw.githubusercontent.com/scriptzteam/Tor-Bridges-Collector/main/bridges-obfs4")
"https://raw.githubusercontent.com/scriptzteam/Tor-Bridges-Collector/main/bridges-obfs4",
timeout=60)
r.encoding = "utf-8"
contents = r.text
self._lines = contents.splitlines()

View file

@ -20,7 +20,8 @@ class BlockBridgeDnscAutomation(BlockBridgeAutomation):
def fetch(self) -> None:
response = requests.get(DOWNLOAD_URL,
headers={"User-Agent": "Mozilla/5.0 (Windows NT x.y; Win64; x64; rv:10.0) "
"Gecko/20100101 Firefox/10.0"})
"Gecko/20100101 Firefox/10.0"},
timeout=60)
self._content = BytesIO(response.content)
def parse(self) -> None:

View file

@ -13,7 +13,7 @@ class BlockBridgeRoskomsvobodaAutomation(BlockBridgeAutomation):
_data: Any
def fetch(self) -> None:
self._data = requests.get("https://reestr.rublacklist.net/api/v3/ips/").json()
self._data = requests.get("https://reestr.rublacklist.net/api/v3/ips/", timeout=180).json()
def parse(self) -> None:
self.ips.extend(self._data)