alloy-python-sdk


Namealloy-python-sdk JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/alloy-automation/alloy-python
SummaryA lightweight Python wrapper for the Alloy API
upload_time2023-12-27 21:03:57
maintainer
docs_urlNone
authorAlloy Automation Inc
requires_python>=3.6
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Alloy Python SDK

This SDK provides a Python interface for interacting with Alloy APIs. It's designed for flexibility and easy integration into Python projects and is distributed via PyPI.

## Installation

The Alloy Python SDK can be easily installed using pip:

```bash
pip install alloy-python-sdk
```

## Usage

The package needs to be configured with your account's API key, which is available in the Alloy Dashboard under settings. You must supply the API key with each instantiation of the module.


### Unified API

To use thie SDK with Alloy's Unified API, use the code snippet below:

```python
from alloy_python.uapi import UAPI
uapi = UAPI('YOUR_API_KEY')
````

### Creating a User

To make API calls to Unified API, you must first [create a user](https://docs-uapi.runalloy.com/reference/create-user). To create a user, call the `User.create_user()` method as seen below. You must pass a unique username.


```python
user_data = {'username': 'john@example.com'}
user_data = user.create_user(user_data)
```


Before you make your first API call, you will need to obtain a `connectionId`. A connectionId represents the unique identifier of an app you plan to make API calls to. You can obtain a connectionId by using the frontend SDK. Read more [here](https://docs-uapi.runalloy.com/docs/unified-api-quick-start).



### Making requests to Alloy Unified API's SDK

Once you have a `connectionId`, you can start making calls to Alloy Unified API. See the example below for making a request to the Commerce Unified API:

```python
from alloy_python.uapi.commerce import Commerce

commerce = Commerce('YOUR_API_KEY')
list_customers_response = commerce.list_customers()
```


### Alloy Embedded

To set up Alloy's Embedded iPaaS, use the code snippet below:

```python
from alloy_python.embedded import Embedded

# Initialize with your API key
embedded = Embedded('YOUR_API_KEY')

# Example usage with the App class
response = embedded.App.get_apps()
print(response)
```






## Testing

### API Key for Testing

To test the SDK, you'll need to set the `ALLOY_API_KEY` environment variable. This can be done in your terminal session:

```bash
export ALLOY_API_KEY="your_api_key_here"
```

### Running Test Scripts

The SDK includes a set of test scripts that you can use to verify its functionality. Before running these scripts, ensure that the `ALLOY_API_KEY` environment variable is set as described above. You may need to replace user IDs, workflow IDs, integration IDs, etc., in the test scripts with those specific to your Alloy account.

Run a test script using:

```bash
python3 test/path_to_test_script.py
```

For example:

```bash
python3 test/apps/get_apps.py
```

## Contributing

Contributions to the SDK are welcome. Please ensure to follow the coding standards and write tests for new features.




            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/alloy-automation/alloy-python",
    "name": "alloy-python-sdk",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "Alloy Automation Inc",
    "author_email": "contact@runalloy.com",
    "download_url": "https://files.pythonhosted.org/packages/21/bc/bedd82bd971e7915ef9425116fd8c504001ae505c158feb30ed1363af1d8/alloy_python_sdk-1.0.1.tar.gz",
    "platform": null,
    "description": "\n# Alloy Python SDK\n\nThis SDK provides a Python interface for interacting with Alloy APIs. It's designed for flexibility and easy integration into Python projects and is distributed via PyPI.\n\n## Installation\n\nThe Alloy Python SDK can be easily installed using pip:\n\n```bash\npip install alloy-python-sdk\n```\n\n## Usage\n\nThe package needs to be configured with your account's API key, which is available in the Alloy Dashboard under settings. You must supply the API key with each instantiation of the module.\n\n\n### Unified API\n\nTo use thie SDK with Alloy's Unified API, use the code snippet below:\n\n```python\nfrom alloy_python.uapi import UAPI\nuapi = UAPI('YOUR_API_KEY')\n````\n\n### Creating a User\n\nTo make API calls to Unified API, you must first [create a user](https://docs-uapi.runalloy.com/reference/create-user). To create a user, call the `User.create_user()` method as seen below. You must pass a unique username.\n\n\n```python\nuser_data = {'username': 'john@example.com'}\nuser_data = user.create_user(user_data)\n```\n\n\nBefore you make your first API call, you will need to obtain a `connectionId`. A connectionId represents the unique identifier of an app you plan to make API calls to. You can obtain a connectionId by using the frontend SDK. Read more [here](https://docs-uapi.runalloy.com/docs/unified-api-quick-start).\n\n\n\n### Making requests to Alloy Unified API's SDK\n\nOnce you have a `connectionId`, you can start making calls to Alloy Unified API. See the example below for making a request to the Commerce Unified API:\n\n```python\nfrom alloy_python.uapi.commerce import Commerce\n\ncommerce = Commerce('YOUR_API_KEY')\nlist_customers_response = commerce.list_customers()\n```\n\n\n### Alloy Embedded\n\nTo set up Alloy's Embedded iPaaS, use the code snippet below:\n\n```python\nfrom alloy_python.embedded import Embedded\n\n# Initialize with your API key\nembedded = Embedded('YOUR_API_KEY')\n\n# Example usage with the App class\nresponse = embedded.App.get_apps()\nprint(response)\n```\n\n\n\n\n\n\n## Testing\n\n### API Key for Testing\n\nTo test the SDK, you'll need to set the `ALLOY_API_KEY` environment variable. This can be done in your terminal session:\n\n```bash\nexport ALLOY_API_KEY=\"your_api_key_here\"\n```\n\n### Running Test Scripts\n\nThe SDK includes a set of test scripts that you can use to verify its functionality. Before running these scripts, ensure that the `ALLOY_API_KEY` environment variable is set as described above. You may need to replace user IDs, workflow IDs, integration IDs, etc., in the test scripts with those specific to your Alloy account.\n\nRun a test script using:\n\n```bash\npython3 test/path_to_test_script.py\n```\n\nFor example:\n\n```bash\npython3 test/apps/get_apps.py\n```\n\n## Contributing\n\nContributions to the SDK are welcome. Please ensure to follow the coding standards and write tests for new features.\n\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A lightweight Python wrapper for the Alloy API",
    "version": "1.0.1",
    "project_urls": {
        "Homepage": "https://github.com/alloy-automation/alloy-python"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3e83f0cf95e9c82aad19d2972bfeaf1eeb62b9142ec8c9a28610cc18004f1190",
                "md5": "535cab3c2edc982abb66b53bfff4a9de",
                "sha256": "6cb697cc1fbe43fc21ae497231956e74d1afc00d5f5c46743e563f8406e026d6"
            },
            "downloads": -1,
            "filename": "alloy_python_sdk-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "535cab3c2edc982abb66b53bfff4a9de",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 15290,
            "upload_time": "2023-12-27T21:03:54",
            "upload_time_iso_8601": "2023-12-27T21:03:54.771419Z",
            "url": "https://files.pythonhosted.org/packages/3e/83/f0cf95e9c82aad19d2972bfeaf1eeb62b9142ec8c9a28610cc18004f1190/alloy_python_sdk-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "21bcbedd82bd971e7915ef9425116fd8c504001ae505c158feb30ed1363af1d8",
                "md5": "0a6c979fb778b34a1954ec8bdf671855",
                "sha256": "2bf7a9cbaf993cc8493d64c4e0666dcb61d6b66758572a64ca42c828692a46f3"
            },
            "downloads": -1,
            "filename": "alloy_python_sdk-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "0a6c979fb778b34a1954ec8bdf671855",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 8697,
            "upload_time": "2023-12-27T21:03:57",
            "upload_time_iso_8601": "2023-12-27T21:03:57.321346Z",
            "url": "https://files.pythonhosted.org/packages/21/bc/bedd82bd971e7915ef9425116fd8c504001ae505c158feb30ed1363af1d8/alloy_python_sdk-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-27 21:03:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "alloy-automation",
    "github_project": "alloy-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "alloy-python-sdk"
}
        
Elapsed time: 0.17852s