latch_cli.utils package#
Submodules#
latch_cli.utils.ldata module#
latch_cli.utils.path module#
Module contents#
Utility functions for services.
- latch_cli.utils.urljoins(*args: str, dir: bool = False) str [source]#
Construct a URL by appending paths
Paths are always joined, with extra /`s added if missing. Does not allow overriding basenames as opposed to normal `urljoin. Whether the final path ends in a / is still significant and will be preserved in the output
>>> urljoin("latch:///directory/", "another_directory") latch:///directory/another_directory >>> # No slash means "another_directory" is treated as a filename >>> urljoin(urljoin("latch:///directory/", "another_directory"), "file") latch:///directory/file >>> # Unintentionally overrode the filename >>> urljoins("latch:///directory/", "another_directory", "file") latch:///directory/another_directory/file >>> # Joined paths as expected
- Parameters:
args – Paths to join
dir – If true, ensure the output ends with a /
- exception latch_cli.utils.AuthenticationError[source]#
Bases:
RuntimeError
- latch_cli.utils.sub_from_jwt(token: str) str [source]#
Extract a user sub (UUID) from a JWT minted by auth0.
- Parameters:
token – JWT
- Returns:
The user sub contained within the JWT.
- latch_cli.utils.generate_temporary_ssh_credentials(ssh_key_path: Path, *, add_to_agent: bool = True) str [source]#
- class latch_cli.utils.TemporarySSHCredentials(ssh_key_path: Path)[source]#
Bases:
object
- property public_key#
- property private_key#