mirror of
https://github.com/Horizontal42/netsleuth.git
synced 2026-11-10 21:32:04 +03:00
Merge bdc2c4a92a into 8c99ac78b7
This commit is contained in:
commit
4e79bed584
3 changed files with 8 additions and 7 deletions
|
|
@ -78,7 +78,7 @@ class Speedtest(BaseModel):
|
|||
upload_sizes_bytes: list[int] = Field(default_factory=lambda: [1_000_000, 5_000_000])
|
||||
cloudflare_base_url: str = "https://speed.cloudflare.com"
|
||||
fastcom_api_url: str = "https://api.fast.com/netflix/speedtest/v2"
|
||||
fastcom_api_token: str = "YXNkZmFzZGxmbnNkYWZoYXNkZmhrYWxm"
|
||||
fastcom_api_token: SecretStr | None = Field(default=None)
|
||||
ndt7_locate_url: str = "https://locate.measurementlab.net/v2/nearest/ndt/ndt7"
|
||||
bufferbloat_probe_interval_seconds: float = 0.2
|
||||
|
||||
|
|
|
|||
|
|
@ -174,9 +174,10 @@ async def tier_cloudflare(client: httpx.AsyncClient, cfg: Speedtest, timeout: fl
|
|||
|
||||
|
||||
async def tier_fastcom(client: httpx.AsyncClient, cfg: Speedtest, timeout: float) -> SpeedResult:
|
||||
token = cfg.fastcom_api_token.get_secret_value() if cfg.fastcom_api_token else ""
|
||||
response = await client.get(
|
||||
cfg.fastcom_api_url,
|
||||
params={"https": "true", "token": cfg.fastcom_api_token, "urlCount": "3"},
|
||||
params={"https": "true", "token": token, "urlCount": "3"},
|
||||
timeout=timeout,
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
|
|
|||
|
|
@ -463,7 +463,7 @@ async def test_tier_fastcom_happy_path(httpx_mock):
|
|||
config = Speedtest()
|
||||
api_url = config.fastcom_api_url
|
||||
httpx_mock.add_response(
|
||||
url=f"{api_url}?https=true&token=YXNkZmFzZGxmbnNkYWZoYXNkZmhrYWxm&urlCount=3",
|
||||
url=f"{api_url}?https=true&token=&urlCount=3",
|
||||
json={
|
||||
"targets": [
|
||||
{
|
||||
|
|
@ -498,7 +498,7 @@ async def test_tier_fastcom_no_targets(httpx_mock):
|
|||
config = Speedtest()
|
||||
api_url = config.fastcom_api_url
|
||||
httpx_mock.add_response(
|
||||
url=f"{api_url}?https=true&token=YXNkZmFzZGxmbnNkYWZoYXNkZmhrYWxm&urlCount=3",
|
||||
url=f"{api_url}?https=true&token=&urlCount=3",
|
||||
json={"targets": []},
|
||||
)
|
||||
async with httpx.AsyncClient() as client:
|
||||
|
|
@ -513,7 +513,7 @@ async def test_tier_fastcom_missing_urls(httpx_mock):
|
|||
config = Speedtest()
|
||||
api_url = config.fastcom_api_url
|
||||
httpx_mock.add_response(
|
||||
url=f"{api_url}?https=true&token=YXNkZmFzZGxmbnNkYWZoYXNkZmhrYWxm&urlCount=3",
|
||||
url=f"{api_url}?https=true&token=&urlCount=3",
|
||||
json={
|
||||
"targets": [
|
||||
{"location": {"country": "US"}},
|
||||
|
|
@ -540,7 +540,7 @@ async def test_tier_fastcom_api_error(httpx_mock):
|
|||
config = Speedtest()
|
||||
api_url = config.fastcom_api_url
|
||||
httpx_mock.add_response(
|
||||
url=f"{api_url}?https=true&token=YXNkZmFzZGxmbnNkYWZoYXNkZmhrYWxm&urlCount=3",
|
||||
url=f"{api_url}?https=true&token=&urlCount=3",
|
||||
status_code=500,
|
||||
)
|
||||
async with httpx.AsyncClient() as client:
|
||||
|
|
@ -553,7 +553,7 @@ async def test_tier_fastcom_download_error(httpx_mock):
|
|||
config = Speedtest()
|
||||
api_url = config.fastcom_api_url
|
||||
httpx_mock.add_response(
|
||||
url=f"{api_url}?https=true&token=YXNkZmFzZGxmbnNkYWZoYXNkZmhrYWxm&urlCount=3",
|
||||
url=f"{api_url}?https=true&token=&urlCount=3",
|
||||
json={
|
||||
"targets": [
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue