android-sms-gateway


Nameandroid-sms-gateway JSON
Version 1.1.1 PyPI version JSON
download
home_pageNone
SummaryA client library for sending and managing SMS messages via the SMS Gateway for Android API
upload_time2024-12-02 22:42:29
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseApache-2.0
keywords android sms gateway
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SMS Gateway for Androidâ„¢ Python API Client

[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=for-the-badge)](https://github.com/android-sms-gateway/client-py/blob/main/LICENSE)
[![GitHub Issues](https://img.shields.io/github/issues/capcom6/android-sms-gateway-py.svg?style=for-the-badge)](https://github.com/android-sms-gateway/client-py/issues)
[![GitHub Stars](https://img.shields.io/github/stars/capcom6/android-sms-gateway-py.svg?style=for-the-badge)](https://github.com/android-sms-gateway/client-py/stargazers)
[![GitHub Forks](https://img.shields.io/github/forks/capcom6/android-sms-gateway-py.svg?style=for-the-badge)](https://github.com/android-sms-gateway/client-py/network)
[![PyPI Version](https://img.shields.io/pypi/v/android-sms-gateway.svg?style=for-the-badge)](https://pypi.org/project/android-sms-gateway/)
[![Python Version](https://img.shields.io/pypi/pyversions/android-sms-gateway.svg?style=for-the-badge)](https://pypi.org/project/android-sms-gateway/)
[![Downloads](https://img.shields.io/pypi/dm/android-sms-gateway.svg?style=for-the-badge)](https://pypi.org/project/android-sms-gateway/)

This is a Python client library for interfacing with the [SMS Gateway for Android](https://sms-gate.app) API.

## Requirements

- Python >= 3.7
- One of the following packages:
    - [requests](https://pypi.org/project/requests/)
    - [aiohttp](https://pypi.org/project/aiohttp/)
    - [httpx](https://pypi.org/project/httpx/)

Optional:

- [pycryptodome](https://pypi.org/project/pycryptodome/) - end-to-end encryption support

## Installation

```bash
pip install android_sms_gateway
```

You can also install with preferred http client:

```bash
pip install android_sms_gateway[requests]
pip install android_sms_gateway[aiohttp]
pip install android_sms_gateway[httpx]
```

With encrypted messages support:

```bash
pip install android_sms_gateway[encryption]
```

## Quickstart

Here's an example of using the client:

```python
import asyncio
import os

from android_sms_gateway import client, domain, Encryptor

login = os.getenv("ANDROID_SMS_GATEWAY_LOGIN")
password = os.getenv("ANDROID_SMS_GATEWAY_PASSWORD")
# encryptor = Encryptor('passphrase') # for end-to-end encryption, see https://sms-gate.app/privacy/encryption/

message = domain.Message(
    "Your message text here.",
    ["+1234567890"],
)

def sync_client():
    with client.APIClient(
        login, 
        password,
        # encryptor=encryptor,
    ) as c:
        state = c.send(message)
        print(state)

        state = c.get_state(state.id)
        print(state)


async def async_client():
    async with client.AsyncAPIClient(
        login, 
        password,
        # encryptor=encryptor,
    ) as c:
        state = await c.send(message)
        print(state)

        state = await c.get_state(state.id)
        print(state)

print("Sync client")
sync_client()

print("\nAsync client")
asyncio.run(async_client())
```

## Client

There are two client classes: `APIClient` and `AsyncAPIClient`. The
`APIClient` is synchronous and the `AsyncAPIClient` is asynchronous. Both
implement the same interface and can be used as context managers.

### Methods

There are two methods:

- `send(message: domain.Message) -> domain.MessageState`: Send a new SMS message.
- `get_state(_id: str) -> domain.MessageState`: Retrieve the state of a previously sent message by its ID.

## HTTP Client

The API clients abstract away the HTTP client used to make requests. The library includes support for some popular HTTP clients and trys to discover them automatically:

- [requests](https://pypi.org/project/requests/) - `APIClient` only
- [aiohttp](https://pypi.org/project/aiohttp/) - `AsyncAPIClient` only
- [httpx](https://pypi.org/project/httpx/) - `APIClient` and `AsyncAPIClient`

Also you can implement your own HTTP client that conforms to the `http.HttpClient` or `ahttp.HttpClient` protocol.

# Contributing

Contributions are welcome! Please submit a pull request or create an issue for anything you'd like to add or change.

# License

This library is open-sourced software licensed under the [Apache-2.0 license](LICENSE).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "android-sms-gateway",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "Aleksandr Soloshenko <support@sms-gate.app>",
    "keywords": "android, sms, gateway",
    "author": null,
    "author_email": "Aleksandr Soloshenko <admin@sms-gate.app>",
    "download_url": "https://files.pythonhosted.org/packages/ad/0b/cfe61045ae7d976031a1d30e930a0d2f943b5f96521e17cff4e7ceb00565/android_sms_gateway-1.1.1.tar.gz",
    "platform": null,
    "description": "# SMS Gateway for Android\u2122 Python API Client\n\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=for-the-badge)](https://github.com/android-sms-gateway/client-py/blob/main/LICENSE)\n[![GitHub Issues](https://img.shields.io/github/issues/capcom6/android-sms-gateway-py.svg?style=for-the-badge)](https://github.com/android-sms-gateway/client-py/issues)\n[![GitHub Stars](https://img.shields.io/github/stars/capcom6/android-sms-gateway-py.svg?style=for-the-badge)](https://github.com/android-sms-gateway/client-py/stargazers)\n[![GitHub Forks](https://img.shields.io/github/forks/capcom6/android-sms-gateway-py.svg?style=for-the-badge)](https://github.com/android-sms-gateway/client-py/network)\n[![PyPI Version](https://img.shields.io/pypi/v/android-sms-gateway.svg?style=for-the-badge)](https://pypi.org/project/android-sms-gateway/)\n[![Python Version](https://img.shields.io/pypi/pyversions/android-sms-gateway.svg?style=for-the-badge)](https://pypi.org/project/android-sms-gateway/)\n[![Downloads](https://img.shields.io/pypi/dm/android-sms-gateway.svg?style=for-the-badge)](https://pypi.org/project/android-sms-gateway/)\n\nThis is a Python client library for interfacing with the [SMS Gateway for Android](https://sms-gate.app) API.\n\n## Requirements\n\n- Python >= 3.7\n- One of the following packages:\n    - [requests](https://pypi.org/project/requests/)\n    - [aiohttp](https://pypi.org/project/aiohttp/)\n    - [httpx](https://pypi.org/project/httpx/)\n\nOptional:\n\n- [pycryptodome](https://pypi.org/project/pycryptodome/) - end-to-end encryption support\n\n## Installation\n\n```bash\npip install android_sms_gateway\n```\n\nYou can also install with preferred http client:\n\n```bash\npip install android_sms_gateway[requests]\npip install android_sms_gateway[aiohttp]\npip install android_sms_gateway[httpx]\n```\n\nWith encrypted messages support:\n\n```bash\npip install android_sms_gateway[encryption]\n```\n\n## Quickstart\n\nHere's an example of using the client:\n\n```python\nimport asyncio\nimport os\n\nfrom android_sms_gateway import client, domain, Encryptor\n\nlogin = os.getenv(\"ANDROID_SMS_GATEWAY_LOGIN\")\npassword = os.getenv(\"ANDROID_SMS_GATEWAY_PASSWORD\")\n# encryptor = Encryptor('passphrase') # for end-to-end encryption, see https://sms-gate.app/privacy/encryption/\n\nmessage = domain.Message(\n    \"Your message text here.\",\n    [\"+1234567890\"],\n)\n\ndef sync_client():\n    with client.APIClient(\n        login, \n        password,\n        # encryptor=encryptor,\n    ) as c:\n        state = c.send(message)\n        print(state)\n\n        state = c.get_state(state.id)\n        print(state)\n\n\nasync def async_client():\n    async with client.AsyncAPIClient(\n        login, \n        password,\n        # encryptor=encryptor,\n    ) as c:\n        state = await c.send(message)\n        print(state)\n\n        state = await c.get_state(state.id)\n        print(state)\n\nprint(\"Sync client\")\nsync_client()\n\nprint(\"\\nAsync client\")\nasyncio.run(async_client())\n```\n\n## Client\n\nThere are two client classes: `APIClient` and `AsyncAPIClient`. The\n`APIClient` is synchronous and the `AsyncAPIClient` is asynchronous. Both\nimplement the same interface and can be used as context managers.\n\n### Methods\n\nThere are two methods:\n\n- `send(message: domain.Message) -> domain.MessageState`: Send a new SMS message.\n- `get_state(_id: str) -> domain.MessageState`: Retrieve the state of a previously sent message by its ID.\n\n## HTTP Client\n\nThe API clients abstract away the HTTP client used to make requests. The library includes support for some popular HTTP clients and trys to discover them automatically:\n\n- [requests](https://pypi.org/project/requests/) - `APIClient` only\n- [aiohttp](https://pypi.org/project/aiohttp/) - `AsyncAPIClient` only\n- [httpx](https://pypi.org/project/httpx/) - `APIClient` and `AsyncAPIClient`\n\nAlso you can implement your own HTTP client that conforms to the `http.HttpClient` or `ahttp.HttpClient` protocol.\n\n# Contributing\n\nContributions are welcome! Please submit a pull request or create an issue for anything you'd like to add or change.\n\n# License\n\nThis library is open-sourced software licensed under the [Apache-2.0 license](LICENSE).\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A client library for sending and managing SMS messages via the SMS Gateway for Android API",
    "version": "1.1.1",
    "project_urls": {
        "Homepage": "https://sms-gate.app",
        "Repository": "https://github.com/android-sms-gateway/client-py"
    },
    "split_keywords": [
        "android",
        " sms",
        " gateway"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6151eebcd6c233f32c012e8df751b93b4e0fe81bb224ec334a354fdb9c1f8667",
                "md5": "581178b646526f7feac9e19411a129b6",
                "sha256": "0fbd6db540c8a757e06a4d3ee08442f697a1eeda7fe3ba755663d2ca0a6d8b09"
            },
            "downloads": -1,
            "filename": "android_sms_gateway-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "581178b646526f7feac9e19411a129b6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 12865,
            "upload_time": "2024-12-02T22:42:27",
            "upload_time_iso_8601": "2024-12-02T22:42:27.987340Z",
            "url": "https://files.pythonhosted.org/packages/61/51/eebcd6c233f32c012e8df751b93b4e0fe81bb224ec334a354fdb9c1f8667/android_sms_gateway-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ad0bcfe61045ae7d976031a1d30e930a0d2f943b5f96521e17cff4e7ceb00565",
                "md5": "6ee289555864f70d62efbd90d4d3041b",
                "sha256": "f658f801b6916b1d460e840dd4b6fa6dcd68c731a001db44a62be9abcb0c751d"
            },
            "downloads": -1,
            "filename": "android_sms_gateway-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "6ee289555864f70d62efbd90d4d3041b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 13433,
            "upload_time": "2024-12-02T22:42:29",
            "upload_time_iso_8601": "2024-12-02T22:42:29.061529Z",
            "url": "https://files.pythonhosted.org/packages/ad/0b/cfe61045ae7d976031a1d30e930a0d2f943b5f96521e17cff4e7ceb00565/android_sms_gateway-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-02 22:42:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "android-sms-gateway",
    "github_project": "client-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "android-sms-gateway"
}
        
Elapsed time: 0.48281s