jetraw package

Module contents

jetraw.get_default_client()

Get the default client instance.

Creates a new default client if none has been set. The default client is used by all global operations when no specific client is provided.

Returns:

The default client instance

Return type:

Client

Example

>>> client = get_default_client()
>>> # Use the client for operations
>>> client.download(JetrawPath("/my-space/file.tiff"))
jetraw.set_default_client(client)

Set the default client instance.

The default client will be used by all global operations when no specific client is provided.

Parameters:

client (Client) – The client instance to use as default

Example

>>> from jetraw import Client
>>> client = Client(organization="my-org")
>>> set_default_client(client)
>>> # Now all global operations use this client
>>> download(JetrawPath("/my-space/file.tiff"))
jetraw.authorize(timeout=None, *, client=None)

Start the authorization flow using a web browser and user credentials.

Opens a web browser for the user to authenticate and authorize the application.

Parameters:
  • timeout (Optional[timedelta]) – Maximum time to wait for authorization (default: 1 minute)

  • client (Optional[Client]) – Client instance to use (uses default if None)

Example

>>> # Authorize with default timeout
>>> authorize()
>>>
>>> # Authorize with custom timeout
>>> from datetime import timedelta
>>> authorize(timeout=timedelta(minutes=5))
jetraw.download(from_path, to_path='', *, client=None, storages=None)

Download files from Jetraw.

Parameters:
  • from_path (Union[List[Path], Path]) – Remote path(s) to download from (JetrawPath, string, or list)

  • to_path (PathLike) – Local path to download to (current directory if empty)

  • client (Optional[Client]) – Client instance to use (uses default if None)

  • storages (Optional[List[str]]) – List of storage IDs to use

Returns:

Result of the download operation

Return type:

str

Example

>>> # Download single file using JetrawPath
>>> download(JetrawPath("/my-space/file.tiff"), "/local/")
>>>
>>> # Download single file using string
>>> download("/my-space/file.tiff", "/local/")
>>>
>>> # Download multiple files
>>> download([
...     JetrawPath("/my-space/file1.tiff"),
...     "/my-space/file2.tiff"
... ], "/local/directory/")
jetraw.upload(from_path, to_path, *, client=None, calibration_id=None)

Upload files to Jetraw.

Parameters:
  • from_path (Union[List[Path], Path]) – Local path(s) to upload from (JetrawPath, string, or list)

  • to_path (PathLike) – Remote path to upload to

  • client (Optional[Client]) – Client instance to use (uses default if None)

  • calibration_id (Optional[str]) – Calibration ID for the upload

Returns:

Result of the upload operation

Return type:

str

Example

>>> # Upload single file using JetrawPath
>>> upload("/local/file.tiff", JetrawPath("/my-space/file.tiff"))
>>>
>>> # Upload single file using string
>>> upload("/local/file.tiff", "/my-space/file.tiff")
>>>
>>> # Upload multiple files
>>> upload([
...     "/local/file1.tiff",
...     "/local/file2.tiff"
... ], JetrawPath("/my-space/directory/"))
class jetraw.Client(*, organization=None, config_file=None, shared_credentials_file=None, host=None, access_token=None, refresh_token=None, refresh_token_if_empty=True, skip_compatibility_check=False)

Main client for interacting with Jetraw services.

Provides authentication, file operations, and connection management for the Jetraw filesystem and services.

Example

>>> # Create client with organization
>>> client = Client(organization="my-org")
>>>
>>> # Create client with explicit host and token
>>> client = Client(host="https://my-org.jetraw.com", access_token="token")
>>>
>>> # Create client from config file
>>> client = Client(config_file="~/.jetraw/config")
jetraw.JetrawPath

alias of Path

Submodules