smsaero-api


Namesmsaero-api JSON
Version 3.1.0 PyPI version JSON
download
home_pagehttps://github.com/smsaero/smsaero_python/
SummaryPython client for working with SMS Aero API.
upload_time2025-09-11 10:38:37
maintainerSMS Aero Team
docs_urlNone
authorSMS Aero
requires_python>=3.6
licenseMIT
keywords smsaero api smsaero_api sms hlr viber
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            # Python library for sending SMS messages via SMS Aero API

[![PyPI version](https://badge.fury.io/py/smsaero-api.svg)](https://badge.fury.io/py/smsaero-api)
[![Python Versions](https://img.shields.io/pypi/pyversions/smsaero-api.svg)](https://pypi.org/project/smsaero-api/)
[![Downloads](https://pepy.tech/badge/smsaero-api)](https://pepy.tech/project/smsaero-api)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](MIT-LICENSE)

## Installation (from PyPI):

```bash
pip install -U smsaero-api
```

## Usage example:

Get credentials from account settings page: https://smsaero.ru/cabinet/settings/apikey/

```python
from pprint import pprint
from smsaero import SmsAero, SmsAeroException


SMSAERO_EMAIL = "your email"
SMSAERO_API_KEY = "your api key"


def send_sms(phone: int, message: str) -> dict:
    """
    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.

    Returns:
    dict: A dictionary containing the response from the SmsAero API.
    """
    api = SmsAero(SMSAERO_EMAIL, SMSAERO_API_KEY)
    return api.send_sms(phone, message)


def send_telegram_code(phone: int, code: int, sign: str = None, text: str = None) -> dict:
    """
    Sends a Telegram code

    Parameters:
    phone (int): The phone number to which the Telegram code will be sent.
    code (int): The Telegram code (4 to 8 digits).
    sign (str, optional): The SMS sender name for fallback.
    text (str, optional): The SMS message text for fallback.

    Returns:
    dict: A dictionary containing the response from the SmsAero API.
    """
    api = SmsAero(SMSAERO_EMAIL, SMSAERO_API_KEY)
    return api.send_telegram(phone, code, sign, text)


if __name__ == "__main__":
    try:
        # Send SMS
        result = send_sms(70000000000, "Hello, World!")
        pprint(result)
        
        # Send Telegram code
        telegram_result = send_telegram_code(70000000000, 1234, "SMS Aero", "Your code is 1234")
        pprint(telegram_result)
    except SmsAeroException as e:
        print(f"An error occurred: {e}")
```

#### 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:latest'
docker run -it --rm 'smsaero/smsaero_python: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+.
* Previous versions of Python supported by versions 2.2.0 and below.


## License:

```
MIT License
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/smsaero/smsaero_python/",
    "name": "smsaero-api",
    "maintainer": "SMS Aero Team",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "support@smsaero.ru",
    "keywords": "smsaero, api, smsaero_api, sms, hlr, viber",
    "author": "SMS Aero",
    "author_email": "admin@smsaero.ru",
    "download_url": "https://files.pythonhosted.org/packages/4e/c7/a698ab5e379ee3af31c234c530dbc76ba674fcdd281bf89e6a89fa76d4bb/smsaero_api-3.1.0.tar.gz",
    "platform": "any",
    "description": "# Python library for sending SMS messages via SMS Aero API\n\n[![PyPI version](https://badge.fury.io/py/smsaero-api.svg)](https://badge.fury.io/py/smsaero-api)\n[![Python Versions](https://img.shields.io/pypi/pyversions/smsaero-api.svg)](https://pypi.org/project/smsaero-api/)\n[![Downloads](https://pepy.tech/badge/smsaero-api)](https://pepy.tech/project/smsaero-api)\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\n```\n\n## Usage example:\n\nGet credentials from account settings page: https://smsaero.ru/cabinet/settings/apikey/\n\n```python\nfrom pprint import pprint\nfrom smsaero import SmsAero, SmsAeroException\n\n\nSMSAERO_EMAIL = \"your email\"\nSMSAERO_API_KEY = \"your api key\"\n\n\ndef send_sms(phone: int, message: str) -> dict:\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    Returns:\n    dict: A dictionary containing the response from the SmsAero API.\n    \"\"\"\n    api = SmsAero(SMSAERO_EMAIL, SMSAERO_API_KEY)\n    return api.send_sms(phone, message)\n\n\ndef send_telegram_code(phone: int, code: int, sign: str = None, text: str = None) -> dict:\n    \"\"\"\n    Sends a Telegram code\n\n    Parameters:\n    phone (int): The phone number to which the Telegram code will be sent.\n    code (int): The Telegram code (4 to 8 digits).\n    sign (str, optional): The SMS sender name for fallback.\n    text (str, optional): The SMS message text for fallback.\n\n    Returns:\n    dict: A dictionary containing the response from the SmsAero API.\n    \"\"\"\n    api = SmsAero(SMSAERO_EMAIL, SMSAERO_API_KEY)\n    return api.send_telegram(phone, code, sign, text)\n\n\nif __name__ == \"__main__\":\n    try:\n        # Send SMS\n        result = send_sms(70000000000, \"Hello, World!\")\n        pprint(result)\n        \n        # Send Telegram code\n        telegram_result = send_telegram_code(70000000000, 1234, \"SMS Aero\", \"Your code is 1234\")\n        pprint(telegram_result)\n    except SmsAeroException as e:\n        print(f\"An error occurred: {e}\")\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:latest'\ndocker run -it --rm 'smsaero/smsaero_python: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* Previous versions of Python supported by versions 2.2.0 and below.\n\n\n## License:\n\n```\nMIT License\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python client for working with SMS Aero API.",
    "version": "3.1.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/smsaero/smsaero_python/issues",
        "Download": "https://github.com/smsaero/smsaero_python/archive/refs/tags/3.0.0.tar.gz",
        "Help Center": "https://smsaero.ru/support/",
        "Homepage": "https://smsaero.ru/",
        "Repository": "https://github.com/smsaero/smsaero_python/"
    },
    "split_keywords": [
        "smsaero",
        " api",
        " smsaero_api",
        " sms",
        " hlr",
        " viber"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "64c2a8227cd88a1a890d317d5ea07d975d8a427a818ab6ba94e3781d2a7846f0",
                "md5": "40db0ecd40202c9ae162313ed3461650",
                "sha256": "4d09097f483f44e68bf4eaf0f2d3243187b372d8b3c9bcd3f5fa45f57f01bb15"
            },
            "downloads": -1,
            "filename": "smsaero_api-3.1.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "40db0ecd40202c9ae162313ed3461650",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 14399,
            "upload_time": "2025-09-11T10:38:35",
            "upload_time_iso_8601": "2025-09-11T10:38:35.919869Z",
            "url": "https://files.pythonhosted.org/packages/64/c2/a8227cd88a1a890d317d5ea07d975d8a427a818ab6ba94e3781d2a7846f0/smsaero_api-3.1.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4ec7a698ab5e379ee3af31c234c530dbc76ba674fcdd281bf89e6a89fa76d4bb",
                "md5": "de2126932f6ae384009d90794283d106",
                "sha256": "ac1fffcf0facf10d4cab9c636a896c5b002616f9fba31b6d3689c38a927d48ad"
            },
            "downloads": -1,
            "filename": "smsaero_api-3.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "de2126932f6ae384009d90794283d106",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 21960,
            "upload_time": "2025-09-11T10:38:37",
            "upload_time_iso_8601": "2025-09-11T10:38:37.011011Z",
            "url": "https://files.pythonhosted.org/packages/4e/c7/a698ab5e379ee3af31c234c530dbc76ba674fcdd281bf89e6a89fa76d4bb/smsaero_api-3.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-11 10:38:37",
    "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"
}
        
Elapsed time: 2.87908s