Connecting
Utilities
There are a few different utilities for connecting to a target, connect
being the simplest:
Note
All connection utilities use http://localhost:5000
as the target by default.
import hoist
@hoist.main # using the main utility
async def main():
async with hoist.connect("...") as conn:
...
If you don't want to use the async with
block, you may use connect_directly
instead:
connect_directly
lets Hoist use a weakref finalizer instead of the context manager.
Finally, you may use the connect_with
decorator, to omit hoist.main
completely:
Manually
If theres some special case where you can't use a utility, you may directly instantiate hoist.Connection
: