android-sms-gateway


Nameandroid-sms-gateway JSON
Version 1.0.0 PyPI version JSON
download
home_page
SummaryA client library for sending and managing SMS messages via the Android SMS Gateway API
upload_time2024-02-09 04:09:23
maintainer
docs_urlNone
author
requires_python>=3.6
licenseApache-2.0
keywords android sms gateway
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Android SMS Gateway Python API Client

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

## Requirements

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

## 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]
```

## Usage

Here's an example of using the client:

```python
import asyncio
import os

from android_sms_gateway import client, domain

login = os.getenv("ANDROID_SMS_GATEWAY_LOGIN")
password = os.getenv("ANDROID_SMS_GATEWAY_PASSWORD")


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

def sync_client():
    with client.APIClient(login, password) 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) 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": "",
    "name": "android-sms-gateway",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "Aleksandr Soloshenko <i@capcom.me>",
    "keywords": "android,sms,gateway",
    "author": "",
    "author_email": "Aleksandr Soloshenko <i@capcom.me>",
    "download_url": "https://files.pythonhosted.org/packages/e5/9d/550fa8160ae09f5a623306fa45243b71f314e1719488ae03f901b1063588/android-sms-gateway-1.0.0.tar.gz",
    "platform": null,
    "description": "# Android SMS Gateway Python API Client\n\nThis is a Python client library for interfacing with the [Android SMS Gateway](https://sms.capcom.me) API.\n\n## Requirements\n\n- Python >= 3.6\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\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\n## Usage\n\nHere's an example of using the client:\n\n```python\nimport asyncio\nimport os\n\nfrom android_sms_gateway import client, domain\n\nlogin = os.getenv(\"ANDROID_SMS_GATEWAY_LOGIN\")\npassword = os.getenv(\"ANDROID_SMS_GATEWAY_PASSWORD\")\n\n\nmessage = domain.Message(\n    \"Your message text here.\",\n    [\"+1234567890\"],\n)\n\ndef sync_client():\n    with client.APIClient(login, password) 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(login, password) 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 Android SMS Gateway API",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://sms.capcom.me",
        "Repository": "https://github.com/capcom6/android-sms-gateway-py"
    },
    "split_keywords": [
        "android",
        "sms",
        "gateway"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d70b5de215ee359f2ac55092bda769cac6d015618ba0b720f8106c71236fad50",
                "md5": "465ccfb444e9e80fd7db5ea3e0f3b9e9",
                "sha256": "2f89da628b46365c30bcbfa61489d7e5d4947bb350aa26ec82ac95ebf22a12f2"
            },
            "downloads": -1,
            "filename": "android_sms_gateway-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "465ccfb444e9e80fd7db5ea3e0f3b9e9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 10862,
            "upload_time": "2024-02-09T04:09:21",
            "upload_time_iso_8601": "2024-02-09T04:09:21.787916Z",
            "url": "https://files.pythonhosted.org/packages/d7/0b/5de215ee359f2ac55092bda769cac6d015618ba0b720f8106c71236fad50/android_sms_gateway-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e59d550fa8160ae09f5a623306fa45243b71f314e1719488ae03f901b1063588",
                "md5": "b155d89114a76793413c0fdb69c40b83",
                "sha256": "0d40dc34f74f3073f558425d8e0adf85a1aedecf819d7debb873c45bbc2ce677"
            },
            "downloads": -1,
            "filename": "android-sms-gateway-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b155d89114a76793413c0fdb69c40b83",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 10002,
            "upload_time": "2024-02-09T04:09:23",
            "upload_time_iso_8601": "2024-02-09T04:09:23.469665Z",
            "url": "https://files.pythonhosted.org/packages/e5/9d/550fa8160ae09f5a623306fa45243b71f314e1719488ae03f901b1063588/android-sms-gateway-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-09 04:09:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "capcom6",
    "github_project": "android-sms-gateway-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "android-sms-gateway"
}
        
Elapsed time: 0.18030s