# 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",
"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/0c/4f/817df467231cfe80047e5ec2438649094d668019b5dd682b9360ed28baa8/alloy_python-1.0.0.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.0",
"project_urls": {
"Homepage": "https://github.com/alloy-automation/alloy-python"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9598cbea7535a41dd948130fe93ca092a7e895194d2ff7b1f332111f112b1ac1",
"md5": "1984b6cdc1e9c33f3a213b2b63878815",
"sha256": "27bc067453cfd9d596ee22699a686e8a7c607b196d5a8b80babbef341c41ebd7"
},
"downloads": -1,
"filename": "alloy_python-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1984b6cdc1e9c33f3a213b2b63878815",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 17897,
"upload_time": "2024-01-03T03:31:21",
"upload_time_iso_8601": "2024-01-03T03:31:21.061086Z",
"url": "https://files.pythonhosted.org/packages/95/98/cbea7535a41dd948130fe93ca092a7e895194d2ff7b1f332111f112b1ac1/alloy_python-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0c4f817df467231cfe80047e5ec2438649094d668019b5dd682b9360ed28baa8",
"md5": "c010fc8804e6eefe95e059fd11e43450",
"sha256": "d731c2c30943f73a695993c24c9b27d6821cf788d3d31bbd7acaef3885629627"
},
"downloads": -1,
"filename": "alloy_python-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "c010fc8804e6eefe95e059fd11e43450",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 9267,
"upload_time": "2024-01-03T03:31:22",
"upload_time_iso_8601": "2024-01-03T03:31:22.973449Z",
"url": "https://files.pythonhosted.org/packages/0c/4f/817df467231cfe80047e5ec2438649094d668019b5dd682b9360ed28baa8/alloy_python-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-03 03:31:22",
"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": [
{
"name": "requests",
"specs": []
}
],
"lcname": "alloy-python"
}