smsaero-api


Namesmsaero-api JSON
Version 3.0.0 PyPI version JSON
download
home_pagehttps://github.com/smsaero/smsaero_python/
SummarySmsAero API client
upload_time2024-07-04 16:06:01
maintainerNone
docs_urlNone
authorSmsAero
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.
            # SmsAero API client

[![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)


if __name__ == '__main__':
    try:
        result = send_sms(79038805678, 'Hello, World!')
        pprint(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 79038805678 --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 79038805678 --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": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "smsaero, api, smsaero_api, sms, hlr, viber",
    "author": "SmsAero",
    "author_email": "admin@smsaero.ru",
    "download_url": "https://files.pythonhosted.org/packages/e7/64/6b9c25df8d867b8fab25295939d430ea43ddedc6f5872a8bf313731b8aaf/smsaero_api-3.0.0.tar.gz",
    "platform": null,
    "description": "# SmsAero API client\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\nif __name__ == '__main__':\n    try:\n        result = send_sms(79038805678, 'Hello, World!')\n        pprint(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 79038805678 --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 79038805678 --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": "SmsAero API client",
    "version": "3.0.0",
    "project_urls": {
        "Homepage": "https://github.com/smsaero/smsaero_python/"
    },
    "split_keywords": [
        "smsaero",
        " api",
        " smsaero_api",
        " sms",
        " hlr",
        " viber"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "63928e670c347fb22e8d98e3042296f9c66526c1a036cf2d89ee51df0cad09f3",
                "md5": "c8629e51ac7b80fc8c45c36b17e5524e",
                "sha256": "913ce45997b0a76ba22351ac5c9c575f46c0a7fcfb3f3d1f6c8fa9101d36472f"
            },
            "downloads": -1,
            "filename": "smsaero_api-3.0.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c8629e51ac7b80fc8c45c36b17e5524e",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 12983,
            "upload_time": "2024-07-04T16:06:00",
            "upload_time_iso_8601": "2024-07-04T16:06:00.241153Z",
            "url": "https://files.pythonhosted.org/packages/63/92/8e670c347fb22e8d98e3042296f9c66526c1a036cf2d89ee51df0cad09f3/smsaero_api-3.0.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e7646b9c25df8d867b8fab25295939d430ea43ddedc6f5872a8bf313731b8aaf",
                "md5": "c0c299f4742774c23529495b3d982754",
                "sha256": "8cded91f47713cc07d6ed889ca4420cf23dcf101b07ca34cf923a3103e5e4137"
            },
            "downloads": -1,
            "filename": "smsaero_api-3.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c0c299f4742774c23529495b3d982754",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 19898,
            "upload_time": "2024-07-04T16:06:01",
            "upload_time_iso_8601": "2024-07-04T16:06:01.662513Z",
            "url": "https://files.pythonhosted.org/packages/e7/64/6b9c25df8d867b8fab25295939d430ea43ddedc6f5872a8bf313731b8aaf/smsaero_api-3.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-04 16:06:01",
    "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: 0.29515s