SmsAero Async API client
Project description
SmsAero async API client
Installation (from PyPI):
pip install -U smsaero-api-async
Usage example:
Get credentials from account settings page: https://smsaero.ru/cabinet/settings/apikey/
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:
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:
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
smsaero_api_async-3.0.0.tar.gz
(19.2 kB
view details)
Built Distribution
File details
Details for the file smsaero_api_async-3.0.0.tar.gz
.
File metadata
- Download URL: smsaero_api_async-3.0.0.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3faac49a47bb09f9bccbd8eba2765e7219dfb9e917d39c8a9b71af11e331381 |
|
MD5 | 48845d0e9df0e5cd5b5b779402af3a57 |
|
BLAKE2b-256 | cdbc27c89e8d05d2de273ef0425773292142a880cfafef14b618ca3b84bfba6a |
File details
Details for the file smsaero_api_async-3.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: smsaero_api_async-3.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba897c91482721d19a4525bc781ccbde29700ebc084d46be9200f03ceba9da53 |
|
MD5 | 2784be7cbb57251c3750b550d73f7745 |
|
BLAKE2b-256 | 3e30e4d9272dfe935414c52405b413928740cb0b687d21bde7790973878340c0 |