# SmsAero async API client
[![PyPI version](https://badge.fury.io/py/smsaero-api-async.svg)](https://badge.fury.io/py/smsaero-api-async)
[![Python Versions](https://img.shields.io/pypi/pyversions/smsaero-api-async.svg)](https://pypi.org/project/smsaero-api-async/)
[![Downloads](https://pepy.tech/badge/smsaero-api-async)](https://pepy.tech/project/smsaero-api-async)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](MIT-LICENSE)
## Installation (from PyPI):
```bash
pip install -U smsaero-api-async
```
## Usage example:
Get credentials from account settings page: https://smsaero.ru/cabinet/settings/apikey/
```python
import pprint
import asyncio
import smsaero
SMSAERO_EMAIL = 'your email'
SMSAERO_API_KEY = 'your api key'
async def send_sms(phone: int, message: str) -> None:
"""
Sends an SMS message
Parameters:
phone (int): The phone number to which the SMS message will be sent.
message (str): The content of the SMS message to be sent.
"""
api = smsaero.SmsAero(SMSAERO_EMAIL, SMSAERO_API_KEY)
try:
result = await api.send_sms(phone, message)
pprint.pprint(result)
finally:
await api.close_session()
if __name__ == '__main__':
asyncio.run(send_sms(70000000000, 'Hello, World!'))
```
#### Exceptions:
* `SmsAeroException` - base exception class for all exceptions raised by the library.
* `SmsAeroConnectionException` - exception raised when there is a connection error.
* `SmsAeroNoMoneyException` - exception raised when there is not enough money in the account.
## Command line usage:
```bash
SMSAERO_EMAIL="your email"
SMSAERO_API_KEY="your api key"
smsaero_send --email "$SMSAERO_EMAIL" --api_key "$SMSAERO_API_KEY" --phone 70000000000 --message 'Hello, World!'
```
## Run on Docker:
```bash
docker pull 'smsaero/smsaero_python_async:latest'
docker run -it --rm 'smsaero/smsaero_python_async:latest' smsaero_send --email "your email" --api_key "your api key" --phone 70000000000 --message 'Hello, World!'
```
## Compatibility:
* Currently version of library is compatible with Python 3.6+.
## License:
```
MIT License
```
Raw data
{
"_id": null,
"home_page": "https://github.com/smsaero/smsaero_python/",
"name": "smsaero-api-async",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "smsaero, api, smsaero_api_async, sms, hlr, viber",
"author": "SmsAero",
"author_email": "admin@smsaero.ru",
"download_url": "https://files.pythonhosted.org/packages/cd/bc/27c89e8d05d2de273ef0425773292142a880cfafef14b618ca3b84bfba6a/smsaero_api_async-3.0.0.tar.gz",
"platform": null,
"description": "# SmsAero async API client\n\n[![PyPI version](https://badge.fury.io/py/smsaero-api-async.svg)](https://badge.fury.io/py/smsaero-api-async)\n[![Python Versions](https://img.shields.io/pypi/pyversions/smsaero-api-async.svg)](https://pypi.org/project/smsaero-api-async/)\n[![Downloads](https://pepy.tech/badge/smsaero-api-async)](https://pepy.tech/project/smsaero-api-async)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](MIT-LICENSE)\n\n## Installation (from PyPI):\n\n```bash\npip install -U smsaero-api-async\n```\n\n## Usage example:\n\nGet credentials from account settings page: https://smsaero.ru/cabinet/settings/apikey/\n\n```python\nimport pprint\nimport asyncio\nimport smsaero\n\n\nSMSAERO_EMAIL = 'your email'\nSMSAERO_API_KEY = 'your api key'\n\n\nasync def send_sms(phone: int, message: str) -> None:\n \"\"\"\n Sends an SMS message\n\n Parameters:\n phone (int): The phone number to which the SMS message will be sent.\n message (str): The content of the SMS message to be sent.\n \"\"\"\n api = smsaero.SmsAero(SMSAERO_EMAIL, SMSAERO_API_KEY)\n try:\n result = await api.send_sms(phone, message)\n pprint.pprint(result)\n finally:\n await api.close_session()\n\n\nif __name__ == '__main__':\n asyncio.run(send_sms(70000000000, 'Hello, World!'))\n```\n\n#### Exceptions:\n\n* `SmsAeroException` - base exception class for all exceptions raised by the library.\n* `SmsAeroConnectionException` - exception raised when there is a connection error.\n* `SmsAeroNoMoneyException` - exception raised when there is not enough money in the account.\n\n\n## Command line usage:\n\n```bash\nSMSAERO_EMAIL=\"your email\"\nSMSAERO_API_KEY=\"your api key\"\n\nsmsaero_send --email \"$SMSAERO_EMAIL\" --api_key \"$SMSAERO_API_KEY\" --phone 70000000000 --message 'Hello, World!'\n```\n\n## Run on Docker:\n\n```bash\ndocker pull 'smsaero/smsaero_python_async:latest'\ndocker run -it --rm 'smsaero/smsaero_python_async:latest' smsaero_send --email \"your email\" --api_key \"your api key\" --phone 70000000000 --message 'Hello, World!'\n```\n\n## Compatibility:\n\n* Currently version of library is compatible with Python 3.6+.\n\n\n## License:\n\n```\nMIT License\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "SmsAero Async API client",
"version": "3.0.0",
"project_urls": {
"Homepage": "https://github.com/smsaero/smsaero_python/"
},
"split_keywords": [
"smsaero",
" api",
" smsaero_api_async",
" sms",
" hlr",
" viber"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3e30e4d9272dfe935414c52405b413928740cb0b687d21bde7790973878340c0",
"md5": "2784be7cbb57251c3750b550d73f7745",
"sha256": "ba897c91482721d19a4525bc781ccbde29700ebc084d46be9200f03ceba9da53"
},
"downloads": -1,
"filename": "smsaero_api_async-3.0.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "2784be7cbb57251c3750b550d73f7745",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6",
"size": 12887,
"upload_time": "2024-07-17T05:38:02",
"upload_time_iso_8601": "2024-07-17T05:38:02.890428Z",
"url": "https://files.pythonhosted.org/packages/3e/30/e4d9272dfe935414c52405b413928740cb0b687d21bde7790973878340c0/smsaero_api_async-3.0.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cdbc27c89e8d05d2de273ef0425773292142a880cfafef14b618ca3b84bfba6a",
"md5": "48845d0e9df0e5cd5b5b779402af3a57",
"sha256": "f3faac49a47bb09f9bccbd8eba2765e7219dfb9e917d39c8a9b71af11e331381"
},
"downloads": -1,
"filename": "smsaero_api_async-3.0.0.tar.gz",
"has_sig": false,
"md5_digest": "48845d0e9df0e5cd5b5b779402af3a57",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 19152,
"upload_time": "2024-07-17T05:38:04",
"upload_time_iso_8601": "2024-07-17T05:38:04.670218Z",
"url": "https://files.pythonhosted.org/packages/cd/bc/27c89e8d05d2de273ef0425773292142a880cfafef14b618ca3b84bfba6a/smsaero_api_async-3.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-17 05:38:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "smsaero",
"github_project": "smsaero_python",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "smsaero-api-async"
}