Spaces:
Paused
Paused
Update webscout.py
Browse files- webscout.py +2 -6
webscout.py
CHANGED
|
@@ -2,8 +2,7 @@ from __future__ import annotations
|
|
| 2 |
|
| 3 |
import html
|
| 4 |
import http.cookiejar as cookiejar
|
| 5 |
-
from xml.etree import ElementTree
|
| 6 |
-
import logging
|
| 7 |
import warnings
|
| 8 |
from concurrent.futures import ThreadPoolExecutor
|
| 9 |
from datetime import datetime, timezone
|
|
@@ -144,7 +143,6 @@ def _expand_proxy_tb_alias(proxy: str | None) -> str | None:
|
|
| 144 |
"""Expand "tb" to a full proxy URL if applicable."""
|
| 145 |
return "socks5://127.0.0.1:9150" if proxy == "tb" else proxy
|
| 146 |
|
| 147 |
-
logger = logging.getLogger("webscout.WEBS")
|
| 148 |
|
| 149 |
|
| 150 |
class WEBS:
|
|
@@ -232,7 +230,6 @@ class WEBS:
|
|
| 232 |
if "time" in str(ex).lower():
|
| 233 |
raise TimeoutE(f"{url} {type(ex).__name__}: {ex}") from ex
|
| 234 |
raise WebscoutE(f"{url} {type(ex).__name__}: {ex}") from ex
|
| 235 |
-
logger.debug(f"_get_url() {resp.url} {resp.status_code} {len(resp.content)}")
|
| 236 |
if resp.status_code == 200:
|
| 237 |
return cast(bytes, resp.content)
|
| 238 |
self._exception_event.set()
|
|
@@ -262,7 +259,6 @@ class WEBS:
|
|
| 262 |
"llama-3-70b": "llama-3.1-70b",
|
| 263 |
}
|
| 264 |
if model in models_deprecated:
|
| 265 |
-
logger.info(f"{model=} is deprecated, using {models_deprecated[model]}")
|
| 266 |
model = models_deprecated[model]
|
| 267 |
models = {
|
| 268 |
"claude-3-haiku": "claude-3-haiku-20240307",
|
|
@@ -1069,7 +1065,7 @@ class WEBS:
|
|
| 1069 |
lat_b -= Decimal(radius) * Decimal(0.008983)
|
| 1070 |
lon_l -= Decimal(radius) * Decimal(0.008983)
|
| 1071 |
lon_r += Decimal(radius) * Decimal(0.008983)
|
| 1072 |
-
|
| 1073 |
|
| 1074 |
cache = set()
|
| 1075 |
results: list[dict[str, str]] = []
|
|
|
|
| 2 |
|
| 3 |
import html
|
| 4 |
import http.cookiejar as cookiejar
|
| 5 |
+
from xml.etree import ElementTreefrom xml.etree import ElementTree
|
|
|
|
| 6 |
import warnings
|
| 7 |
from concurrent.futures import ThreadPoolExecutor
|
| 8 |
from datetime import datetime, timezone
|
|
|
|
| 143 |
"""Expand "tb" to a full proxy URL if applicable."""
|
| 144 |
return "socks5://127.0.0.1:9150" if proxy == "tb" else proxy
|
| 145 |
|
|
|
|
| 146 |
|
| 147 |
|
| 148 |
class WEBS:
|
|
|
|
| 230 |
if "time" in str(ex).lower():
|
| 231 |
raise TimeoutE(f"{url} {type(ex).__name__}: {ex}") from ex
|
| 232 |
raise WebscoutE(f"{url} {type(ex).__name__}: {ex}") from ex
|
|
|
|
| 233 |
if resp.status_code == 200:
|
| 234 |
return cast(bytes, resp.content)
|
| 235 |
self._exception_event.set()
|
|
|
|
| 259 |
"llama-3-70b": "llama-3.1-70b",
|
| 260 |
}
|
| 261 |
if model in models_deprecated:
|
|
|
|
| 262 |
model = models_deprecated[model]
|
| 263 |
models = {
|
| 264 |
"claude-3-haiku": "claude-3-haiku-20240307",
|
|
|
|
| 1065 |
lat_b -= Decimal(radius) * Decimal(0.008983)
|
| 1066 |
lon_l -= Decimal(radius) * Decimal(0.008983)
|
| 1067 |
lon_r += Decimal(radius) * Decimal(0.008983)
|
| 1068 |
+
|
| 1069 |
|
| 1070 |
cache = set()
|
| 1071 |
results: list[dict[str, str]] = []
|