BoostyClient
boostylib.client.BoostyClient
Main client for the Boosty.to API.
Provides access to all API modules, event system, and caching.
Example::
async with BoostyClient(access_token="...") as client:
user = await client.users.get_current_user()
print(user.name)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
access_token
|
str | None
|
Static access token (no auto-refresh). |
None
|
credentials
|
AuthCredentials | None
|
Full credentials for auto-refresh. |
None
|
token_storage
|
TokenStorage | None
|
Custom token storage backend. |
None
|
settings
|
BoostySettings | None
|
Client configuration. |
None
|
http_client
|
AsyncClient | None
|
Custom httpx.AsyncClient (for testing or proxies). |
None
|
middleware
|
list[Any] | None
|
List of middleware instances. |
None
|
cache
|
CacheBackend | None
|
Custom cache backend (default: MemoryCache if enabled). |
None
|
blog_username
|
str
|
Blog username for event polling. |
''
|
Source code in src/boostylib/client.py
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 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
users = UsersAPI(self._transport)
instance-attribute
blogs = BlogsAPI(self._transport)
instance-attribute
posts = PostsAPI(self._transport)
instance-attribute
comments = CommentsAPI(self._transport)
instance-attribute
subscriptions = SubscriptionsAPI(self._transport)
instance-attribute
donations = DonationsAPI(self._transport)
instance-attribute
targets = TargetsAPI(self._transport)
instance-attribute
showcase = ShowcaseAPI(self._transport)
instance-attribute
media = MediaAPI(self._transport)
instance-attribute
cache = CacheManager(backend=cache, enabled=(self._settings.cache_enabled), ttl_blog=(self._settings.cache_ttl_blog), ttl_levels=(self._settings.cache_ttl_levels), ttl_user=(self._settings.cache_ttl_user), ttl_default=(self._settings.cache_ttl_default))
instance-attribute
bundles = BundlesAPI(self._transport)
instance-attribute
__init__(*, access_token=None, credentials=None, token_storage=None, settings=None, http_client=None, middleware=None, cache=None, blog_username='')
Source code in src/boostylib/client.py
on(event_type)
Decorator to register an event handler.
Example::
@client.on(EventType.NEW_DONATION)
async def handle(event):
print(event.amount)
Source code in src/boostylib/client.py
start_polling(blog_username=None)
async
Start the event polling loop. Blocks until stopped.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blog_username
|
str | None
|
Override the blog to poll (if not set in constructor). |
None
|