Compare commits
3
Commits
385425b180
..
v1.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d5caac8d8 | ||
|
|
5699aa9dde | ||
|
|
e44c8950ee |
@@ -9,15 +9,15 @@ edits. **Credentials are always injected — never hardcoded.**
|
||||
## Install
|
||||
|
||||
```
|
||||
aioproxies @ git+ssh://git@git.rethinkstudios.io/rethink-public/aioproxies.git@v0.3.2
|
||||
aioproxies @ git+ssh://git@git.rethinkstudios.io/rethink-public/aioproxies.git@v1.0.0
|
||||
# network helpers (current_ip / reset) need the extra:
|
||||
aioproxies[net] @ git+ssh://git@git.rethinkstudios.io/rethink-public/aioproxies.git@v0.3.2
|
||||
aioproxies[net] @ git+ssh://git@git.rethinkstudios.io/rethink-public/aioproxies.git@v1.0.0
|
||||
```
|
||||
|
||||
The core has no dependencies. The `net` extra adds `aiohttp` for `current_ip` /
|
||||
`reset`.
|
||||
|
||||
Drop the `@v0.3.2` suffix from the line above to install the latest unpinned.
|
||||
Drop the `@v1.0.0` suffix from the line above to install the latest unpinned.
|
||||
|
||||
## Formatting
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "aioproxies"
|
||||
version = "1.0.0"
|
||||
version = "1.1.0"
|
||||
description = "proxy parsing, formatting, health, and pool management for aiohttp/aioweb, camoufox, and socks5"
|
||||
requires-python = ">=3.10"
|
||||
dependencies = []
|
||||
|
||||
+14
-1
@@ -6,11 +6,24 @@ calling a function without it raises a clear error.
|
||||
"""
|
||||
import logging
|
||||
from typing import Optional, Union
|
||||
from urllib.parse import urlsplit, urlunsplit
|
||||
|
||||
from .proxy import Proxy, to_proxy
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def _safe_url(url: str) -> str:
|
||||
"""strip query + fragment from a url for logging - a provider reset url can carry a
|
||||
rotation token in its query/path; this drops the query/fragment (the usual token spot)
|
||||
so the log line can't leak it. falls back to the raw url only if it won't parse"""
|
||||
try:
|
||||
parts = urlsplit(url)
|
||||
except ValueError:
|
||||
return url
|
||||
return urlunsplit((parts.scheme, parts.netloc, parts.path, "", ""))
|
||||
|
||||
|
||||
try:
|
||||
import aiohttp
|
||||
|
||||
@@ -55,7 +68,7 @@ async def reset(reset_url: str, *, timeout: float = 15.0) -> bool:
|
||||
async with aiohttp.ClientSession(timeout=t) as session:
|
||||
async with session.get(reset_url) as resp:
|
||||
ok = resp.status == 200
|
||||
log.info("proxy reset %s -> %s", reset_url, resp.status)
|
||||
log.info("proxy reset %s -> %s", _safe_url(reset_url), resp.status)
|
||||
return ok
|
||||
except Exception as exc:
|
||||
log.warning("proxy reset failed: %s", exc)
|
||||
|
||||
Reference in New Issue
Block a user