Transport¶
HTTP transport layer for vgmdb-client.
Authenticated, Cloudflare-aware fetching of vgmdb pages with sync and async clients over a shared sans-I/O core.
AsyncTransport
¶
Authenticated, Cloudflare-aware asynchronous fetcher for vgmdb pages.
An instance is scoped to a single event loop (its throttle lock and httpx client bind to the loop they are used on); do not share one instance across concurrently-running loops.
Source code in src/vgmdb_client/transport/async_client.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
get(path)
async
¶
Fetch path and return the HTML body, or raise a typed transport error.
Source code in src/vgmdb_client/transport/async_client.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
set_cf_clearance(token)
¶
Update the cf_clearance cookie used by subsequent requests.
Source code in src/vgmdb_client/transport/async_client.py
67 68 69 70 | |
set_user_agent(user_agent)
¶
Update the User-Agent header used by subsequent requests.
Source code in src/vgmdb_client/transport/async_client.py
72 73 74 75 | |
CloudflareChallengeError
¶
Bases: TransportError
Raised when vgmdb returns a Cloudflare challenge.
This is not retried: a missing or stale cf_clearance token will not
resolve by retrying. Supply or refresh the token and try again.
Source code in src/vgmdb_client/transport/errors.py
15 16 17 18 19 20 21 22 23 24 25 26 | |
NotFoundError
¶
Bases: TransportError
Raised for an application-level 404 (no such resource).
Source code in src/vgmdb_client/transport/errors.py
29 30 31 32 33 | |
RateLimitedError
¶
Bases: TransportError
Raised for a 429 response.
Exposes retry_after (seconds) when the server provided a
Retry-After header. The transport does not auto-retry rate limits.
Source code in src/vgmdb_client/transport/errors.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
SyncTransport
¶
Authenticated, Cloudflare-aware synchronous fetcher for vgmdb pages.
Source code in src/vgmdb_client/transport/sync_client.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
get(path)
¶
Fetch path and return the HTML body, or raise a typed transport error.
Source code in src/vgmdb_client/transport/sync_client.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
set_cf_clearance(token)
¶
Update the cf_clearance cookie used by subsequent requests.
Source code in src/vgmdb_client/transport/sync_client.py
61 62 63 64 | |
set_user_agent(user_agent)
¶
Update the User-Agent header used by subsequent requests.
Source code in src/vgmdb_client/transport/sync_client.py
66 67 68 69 | |
TransientTransportError
¶
Bases: TransportError
Raised for retryable failures (connection errors, timeouts, 5xx).
Propagates only after retries are exhausted.
Source code in src/vgmdb_client/transport/errors.py
53 54 55 56 57 58 59 60 | |
TransportConfig
¶
Bases: BaseModel
Settings for a vgmdb transport client.
user_agent is required and must match the browser the cf_clearance
token was issued for. A min_interval of 0 disables the politeness
throttle.
Source code in src/vgmdb_client/transport/config.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
TransportError
¶
Bases: VgmdbClientError
Base class for all transport-layer failures.
Source code in src/vgmdb_client/transport/errors.py
8 9 10 11 12 | |