Client
class Client(object)is_closed
is_closed(self)Check if the client is closed.
Returns
True if the client is closed, False otherwise.
close
close(self)Close this client and release its connections and background tasks.
Calling this method more than once is safe. The client cannot be used for requests after closing. Clients can also be used as context managers to close them automatically on exit.
hello
hello(self)Connect to server and retrieve version information; raise appropriate error for various failures.
Usage
client = modal.Client.from_env()
client.hello()from_credentials
from_credentials(cls, token_id, token_secret)Constructor based on token credentials; useful for managing Modal on behalf of third-party users.
Also useful when it's necessary to explicitly manage the lifecycle of the client (e.g. when running Modal in a forked subprocess) — see troubleshooting.
Parameters
Returns
An authenticated Client with its connection opened.
Usage
client = modal.Client.from_credentials("my_token_id", "my_token_secret")
modal.Sandbox.create("echo", "hi", client=client, app=app)from_oauth_credentials
from_oauth_credentials(cls, refresh_token, *, oauth_client_id,
oauth_client_secret=None, oauth_jwt_key=None)Constructor based on OAuth credentials; useful for managing Modal on behalf of third-party users.
Parameters
Returns
An authenticated Client with its connection opened.
Usage
client = modal.Client.from_oauth_credentials(
refresh_token,
oauth_client_id=oauth_client_id,
oauth_client_secret=oauth_client_secret,
)
modal.Sandbox.create("echo", "hi", client=client, app=app)get_input_plane_metadata
get_input_plane_metadata(self, input_plane_region)Get the metadata for the input plane.
Parameters
Returns
The metadata for the input plane as a list of header/value tuples.