Skip to content

API Reference

Flat, alphabetized index of everything importable from v2hub. See the linked page for full details on each.

Clients

Name Description
AsyncVPNClient Async API client
VPNClient Sync API client (wraps AsyncVPNClient)

Configuration

Name Description
CircuitBreakerConfig Circuit breaker behavior
CircuitState Enum: CLOSED, OPEN, HALF_OPEN
RetryConfig Retry/backoff behavior

Models — subscriptions & sources

Name Description
RefreshSubscriptionResponse Result of refresh_subscription()
Source A single resolved source within a subscription
SourceAddRequest Internal request model behind add_sources()
SourceCreate Input shape for adding/replacing sources
SourceRemoveRequest Internal request model behind remove_sources()
SourceReplaceRequest Internal request model behind replace_sources()
SourceType Enum: config, external_url, internal_token
SourceUpdateRequest Internal request model behind update_source()
Subscription Full subscription resource
SubscriptionCreateRequest Internal request model behind create_subscription()
SubscriptionListItem Subscription as returned by list_subscriptions()
SubscriptionUpdateRequest Internal request model behind update_subscription()
CommentUpdateRequest Deprecated — request model behind update_comment()

Models — public access

Name Description
PublicSubscriptionResponse Resolved public subscription content, with .decode() / .get_configs() / .config_count

Models — providers & self-service

Name Description
ConnectionResponse A single provider connection (self-service view)
ConnectionsResponse Result of list_connections()
MeResponse Result of get_me()
ProviderAuthorizationStatus Enum: approved, pending, revoked, unknown
ProviderConnectionCreateResponse Result of create_provider_connection()
ProviderConnectionDeleteResponse Result of delete_provider_connection()
ProviderConnectionRequest Internal request model for provider-connection endpoints
ProviderConnectionResponse A provider→user connection (provider view)

Models — errors

Name Description
ErrorResponse Shape of the server's JSON error body

Exceptions

Name Description
AuthenticationError Invalid or missing API token (401)
AuthorizationError Insufficient permissions (403)
CacheError Server-side cache operation failed
CircularReferenceError Circular reference between sources
ConflictError Resource conflict (409)
DuplicateNameError Name already exists
ExternalFetchError Failed to fetch an external URL source
InvalidAuthorizationStatusError Connection not in the expected status
InvalidConfigError Invalid config format
InvalidURLError URL rejected by SSRF protection
NestingTooDeepError Max nesting depth exceeded
NetworkError Network/connection failure
NotFoundError Resource not found (404)
RateLimitError Rate limit exceeded (429)
ServerError Internal server error (500)
ServiceUnavailableError Service unavailable (502/503)
SourceNotFoundError Source ID not found
SubscriptionNotFoundError Subscription not found
TimeoutError Request or gateway timeout
TooManyConfigsError Per-subscription config limit reached
TooManyProvidersError Per-user provider limit reached
TooManySourcesError Per-subscription source limit reached
TooManySubscriptionsError Per-account subscription limit reached
ValidationError Request validation failed (400/422)
VPNAPIError Base exception for all errors

Internals (not exported from the top-level package)

Name Module Description
CircuitBreaker v2hub.core.retry Implements the circuit breaker state machine
HTTPClient v2hub.http.client Underlying HTTP client wrapping httpx.AsyncClient
LoggingMiddleware v2hub.http.middleware Logs requests/responses
MetricsMiddleware v2hub.http.middleware Tracks request count/duration/error rate
Middleware v2hub.http.client Base class for HTTP middleware
RequestContext v2hub.http.client Per-request metadata passed through middleware
RetryMiddleware v2hub.http.middleware Tracks retry attempts on the request context
get_exception_for_error() v2hub.core.exceptions Maps an error-body error field to a typed exception
get_exception_for_exception() v2hub.core.exceptions Wraps a transport/runtime exception (e.g. httpx) into the client's hierarchy
get_exception_for_status() v2hub.core.exceptions Maps an HTTP status code to a typed exception
with_async_retry() v2hub.core.retry Decorator applying retry logic to async methods
with_retry() v2hub.core.retry Decorator applying retry logic to sync functions

Package metadata

Name Description
v2hub.__version__ Installed package version
v2hub.__author__ Package author metadata
v2hub.__api_version__ API version path segment used for all requests (currently "v1")