Name | iot-storage-client JSON |
Version |
1.2.2
JSON |
| download |
home_page | |
Summary | IoT Storage Client Library for Python |
upload_time | 2022-12-14 04:56:29 |
maintainer | |
docs_url | None |
author | Dylan Gonzales |
requires_python | >=3.7 |
license | MIT License |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# iot-storage-client
[](https://www.python.org/) [](https://pre-commit.com/) [](https://keepachangelog.com/en/1.0.0/) [](https://github.com/features/actions) [](https://pypi.org/) [](https://pypi.org/project/azure-storage-blob/)
This package is a wrapper around the [azure-storage-blob](https://pypi.org/project/azure-storage-blob/) SDK to provide an asynchronous and synchronous client for interacting with Azure storage accounts in the cloud and on the edge.
[Official Documentation](https://py-iot-utils.com/packages/iotStorageClient) ([async version](https://py-iot-utils.com/packages/iotStorageClientAsync)) | [Source code](https://github.com/dgonzo27/py-iot-utils/tree/master/iot-storage-client) | [Package PyPI](https://pypi.org/project/iot-storage-client/)
## Table of Contents
- [Versioning](#versioning)
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Basic Examples](#basic-examples)
## Versioning
This repository adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). It will be maintained through the `CHANGELOG.md` and in GitHub Releases. **It's important to note** that you must maintain the version with your releases in `iot/storage/client/_version.py`, otherwise a new package version will fail to get published.
## Getting Started
This section provides basic examples with the `iot-storage-client`.
### Prerequisites
- Python 3.7 or later is required to use this package.
- You must have an Azure subscription and Azure storage account to use this package.
### Basic Examples
1. Install via [pip](https://pypi.org/project/pip/):
```sh
pip install iot-storage-client
```
2. Import and say hello:
```python
from iot.storage.client import __version__
print(f"hello world from iot-storage-client version: {__version__}")
```
3. Basic usage:
```python
import tempfile
from iot.storage.client import CredentialType, LocationType, IoTStorageClient
# instantiate client
storage_client = IoTStorageClient(
credential_type=CredentialType.ACCOUNT_KEY,
location_type=LocationType.CLOUD_BASED,
account_name="myAzBlobStorageAcctName",
credential="myBlobPrimaryKey***"
)
# print info w/ repr
print(f"{storage_client.__repr__()}")
# download blob to tempfile
temp_file = tempfile.NamedTemporaryFile()
download_result = storage_client.download_file(
container_name="myAzBlobContainerName",
source="path/to/blob.txt",
dest=temp_file.name,
)
if not download_result:
print("unable to download file")
temp_file.close()
raise
# upload tempfile to blob
upload_result = storage_client.upload_file(
container_name="myAzBlobContainerName",
source=temp_file.name,
dest="path/to/new/blob.txt",
)
if not upload_result:
print("unable to upload file")
temp_file.close()
raise
# clean-up local memory
temp_file.close()
```
4. Basic async usage:
```python
import tempfile
from iot.storage.client import CredentialType, LocationType, IoTStorageClientAsync
# instantiate client
storage_client = IoTStorageClientAsync(
credential_type=CredentialType.ACCOUNT_KEY,
location_type=LocationType.CLOUD_BASED,
account_name="myAzBlobStorageAcctName",
credential="myBlobPrimaryKey***"
)
# print info w/ repr
print(f"{storage_client.__repr__()}")
# download blob to tempfile
temp_file = tempfile.NamedTemporaryFile()
download_result = await storage_client.download_file(
container_name="myAzBlobContainerName",
source="path/to/blob.txt",
dest=temp_file.name,
)
if not download_result:
print("unable to download file")
temp_file.close()
raise
# upload tempfile to blob
upload_result = await storage_client.upload_file(
container_name="myAzBlobContainerName",
source=temp_file.name,
dest="path/to/new/blob.txt",
)
if not upload_result:
print("unable to upload file")
temp_file.close()
raise
# clean-up local memory
temp_file.close()
```
Raw data
{
"_id": null,
"home_page": "",
"name": "iot-storage-client",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "Dylan Gonzales",
"author_email": "py.iot.utils@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/de/3d/d0434dd99a99ea8e599233ca204fa57389b4a0727c322a2fc9bbfa770426/iot-storage-client-1.2.2.tar.gz",
"platform": null,
"description": "# iot-storage-client\n\n[](https://www.python.org/) [](https://pre-commit.com/) [](https://keepachangelog.com/en/1.0.0/) [](https://github.com/features/actions) [](https://pypi.org/) [](https://pypi.org/project/azure-storage-blob/)\n\nThis package is a wrapper around the [azure-storage-blob](https://pypi.org/project/azure-storage-blob/) SDK to provide an asynchronous and synchronous client for interacting with Azure storage accounts in the cloud and on the edge.\n\n[Official Documentation](https://py-iot-utils.com/packages/iotStorageClient) ([async version](https://py-iot-utils.com/packages/iotStorageClientAsync)) | [Source code](https://github.com/dgonzo27/py-iot-utils/tree/master/iot-storage-client) | [Package PyPI](https://pypi.org/project/iot-storage-client/)\n\n## Table of Contents\n\n- [Versioning](#versioning)\n- [Getting Started](#getting-started)\n - [Prerequisites](#prerequisites)\n - [Basic Examples](#basic-examples)\n\n## Versioning\n\nThis repository adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). It will be maintained through the `CHANGELOG.md` and in GitHub Releases. **It's important to note** that you must maintain the version with your releases in `iot/storage/client/_version.py`, otherwise a new package version will fail to get published.\n\n## Getting Started\n\nThis section provides basic examples with the `iot-storage-client`.\n\n### Prerequisites\n\n- Python 3.7 or later is required to use this package.\n\n- You must have an Azure subscription and Azure storage account to use this package.\n\n### Basic Examples\n\n1. Install via [pip](https://pypi.org/project/pip/):\n\n ```sh\n pip install iot-storage-client\n ```\n\n2. Import and say hello:\n\n ```python\n from iot.storage.client import __version__\n\n\n print(f\"hello world from iot-storage-client version: {__version__}\")\n ```\n\n3. Basic usage:\n\n ```python\n import tempfile\n\n from iot.storage.client import CredentialType, LocationType, IoTStorageClient\n\n # instantiate client\n storage_client = IoTStorageClient(\n credential_type=CredentialType.ACCOUNT_KEY,\n location_type=LocationType.CLOUD_BASED,\n account_name=\"myAzBlobStorageAcctName\",\n credential=\"myBlobPrimaryKey***\"\n )\n\n # print info w/ repr\n print(f\"{storage_client.__repr__()}\")\n\n # download blob to tempfile\n temp_file = tempfile.NamedTemporaryFile()\n download_result = storage_client.download_file(\n container_name=\"myAzBlobContainerName\",\n source=\"path/to/blob.txt\",\n dest=temp_file.name,\n )\n if not download_result:\n print(\"unable to download file\")\n temp_file.close()\n raise\n\n # upload tempfile to blob\n upload_result = storage_client.upload_file(\n container_name=\"myAzBlobContainerName\",\n source=temp_file.name,\n dest=\"path/to/new/blob.txt\",\n )\n if not upload_result:\n print(\"unable to upload file\")\n temp_file.close()\n raise\n\n # clean-up local memory\n temp_file.close()\n ```\n\n4. Basic async usage:\n\n ```python\n import tempfile\n\n from iot.storage.client import CredentialType, LocationType, IoTStorageClientAsync\n\n # instantiate client\n storage_client = IoTStorageClientAsync(\n credential_type=CredentialType.ACCOUNT_KEY,\n location_type=LocationType.CLOUD_BASED,\n account_name=\"myAzBlobStorageAcctName\",\n credential=\"myBlobPrimaryKey***\"\n )\n\n # print info w/ repr\n print(f\"{storage_client.__repr__()}\")\n\n # download blob to tempfile\n temp_file = tempfile.NamedTemporaryFile()\n download_result = await storage_client.download_file(\n container_name=\"myAzBlobContainerName\",\n source=\"path/to/blob.txt\",\n dest=temp_file.name,\n )\n if not download_result:\n print(\"unable to download file\")\n temp_file.close()\n raise\n\n # upload tempfile to blob\n upload_result = await storage_client.upload_file(\n container_name=\"myAzBlobContainerName\",\n source=temp_file.name,\n dest=\"path/to/new/blob.txt\",\n )\n if not upload_result:\n print(\"unable to upload file\")\n temp_file.close()\n raise\n\n # clean-up local memory\n temp_file.close()\n ```\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "IoT Storage Client Library for Python",
"version": "1.2.2",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "d42b411b3754f04d74e16f50ddbfd230",
"sha256": "3c869bdbd8ca7823ae104215d12b01bfe80c4adc0ea827487a88187748f931d3"
},
"downloads": -1,
"filename": "iot_storage_client-1.2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d42b411b3754f04d74e16f50ddbfd230",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 11211,
"upload_time": "2022-12-14T04:56:27",
"upload_time_iso_8601": "2022-12-14T04:56:27.702723Z",
"url": "https://files.pythonhosted.org/packages/29/95/072b21a35de7fdde7d092b479ad86d94c7dcf2edb3ad492819b3da0ec86e/iot_storage_client-1.2.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "52ba960a8dcba32dcf0da5acf0be833e",
"sha256": "205431ed1ad334ef2e5c0b8c88dd2225a007728cc751f38dc8d3d280cfe639bd"
},
"downloads": -1,
"filename": "iot-storage-client-1.2.2.tar.gz",
"has_sig": false,
"md5_digest": "52ba960a8dcba32dcf0da5acf0be833e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 10117,
"upload_time": "2022-12-14T04:56:29",
"upload_time_iso_8601": "2022-12-14T04:56:29.267257Z",
"url": "https://files.pythonhosted.org/packages/de/3d/d0434dd99a99ea8e599233ca204fa57389b4a0727c322a2fc9bbfa770426/iot-storage-client-1.2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-14 04:56:29",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "iot-storage-client"
}