cradle.sdk

Cradle Platform API SDK

This SDK provides a convenient Python interface for interacting with the Cradle Platform APIs. It allows you to programmatically access and manage your data, projects, rounds, and tasks within the Cradle platform.

Key Features:

  • Seamless OAuth authentication with the Cradle Platform via device flow.
  • Easy access to various client interfaces for different API functionalities (Data, Project, Round, Task).
  • Simplified data upload and management.

Getting Started:

  1. Installation: Install the SDK using pip::
    pip install cradle-sdk
  1. Authentication: The SDK uses OAuth device flow for authentication. Simply instantiate the client, and it will provide you with a URL to complete authentication in your browser.

  2. Basic Usage: Initialize the client and follow the authentication prompt:

    from cradle.sdk import Client
    
    # Initialize the client - this will prompt for authentication
    client = Client(workspace="YOUR_WORKSPACE_NAME")
    
    # The client will display a message like this:
    # Please click the following URL to complete authentication
    # https://signin.cradle.bio/device?user_code=XXXX-XXXX
    # and verify that the code matches: XXXX-XXXX
    
    # After authenticating in your browser via SSO or Cradle credentials,
    # the client will be ready to use.
    
    # Access specific API clients
    data_client = client.data
    project_client = client.project
    round_client = client.round
    task_client = client.task
    
    # Example: List projects
    projects = project_client.list()
    for project in projects:
        print(project.name)
    

For detailed documentation on each module and class, please refer to the respective sections.

 1"""Cradle Platform API SDK
 2
 3This SDK provides a convenient Python interface for interacting with the Cradle Platform APIs.
 4It allows you to programmatically access and manage your data, projects, rounds, and tasks within the Cradle platform.
 5
 6Key Features:
 7- Seamless OAuth authentication with the Cradle Platform via device flow.
 8- Easy access to various client interfaces for different API functionalities (Data, Project, Round, Task).
 9- Simplified data upload and management.
10
11Getting Started:
121.  Installation:
13    Install the SDK using pip::
14
15        pip install cradle-sdk
16
172.  Authentication:
18    The SDK uses OAuth device flow for authentication. Simply instantiate the client,
19    and it will provide you with a URL to complete authentication in your browser.
20
213.  Basic Usage:
22    Initialize the client and follow the authentication prompt:
23    ```python
24    from cradle.sdk import Client
25
26    # Initialize the client - this will prompt for authentication
27    client = Client(workspace="YOUR_WORKSPACE_NAME")
28
29    # The client will display a message like this:
30    # Please click the following URL to complete authentication
31    # https://signin.cradle.bio/device?user_code=XXXX-XXXX
32    # and verify that the code matches: XXXX-XXXX
33
34    # After authenticating in your browser via SSO or Cradle credentials,
35    # the client will be ready to use.
36
37    # Access specific API clients
38    data_client = client.data
39    project_client = client.project
40    round_client = client.round
41    task_client = client.task
42
43    # Example: List projects
44    projects = project_client.list()
45    for project in projects:
46        print(project.name)
47    ```
48
49For detailed documentation on each module and class, please refer to the respective sections.
50"""
51
52from .client import (
53    Client as Client,
54    DataClient as DataClient,
55    DataLoadClient as DataLoadClient,
56    ProjectClient as ProjectClient,
57    RoundClient as RoundClient,
58    TaskClient as TaskClient,
59)
60from .exceptions import ClientError as ClientError