playmobile-client


Nameplaymobile-client JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/absolutionsuz/playmobile-client
SummaryPython client for Playmobile.uz API
upload_time2023-01-18 18:12:14
maintainer
docs_urlNone
authorDaniil Andreev
requires_python>=3.7,<4.0
licenseBSD-3-Clause
keywords playmobile smsxabar client httpx requests
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python client for Playmobile.uz API (aka smsxabar.uz)

This is Python HTTP Client for [Playmobile.uz](https://playmobile.uz) (aka [smsxabar.uz](https://smsxabar.uz))
based on [httpx](https://github.com/encode/httpx).

Playmobile is a SMS broker which allows you to send messages throughout Uzbekistan.

## Installation

To install playmobile-client, simply:

``` bash
$ pip install playmobile-client
```
This package can be found on [PyPI](https://pypi.org/project/playmobile-client/).

## Usage

```python
import httpx
import playmobile

client = playmobile.HttpClient(
    account=playmobile.Credentials(
        username="example",
        password="example",
    ),
    base_url=httpx.URL("https://playmobile-example.uz"),
    session=httpx.Client(),
)

sms = playmobile.SMS(
    id="unique_string",
    sender="0001",
    recipient="998xx3332211",
    text="Hello world!",
)

# Single SMS
client.send_sms(sms)

# SMS batch
sms_batch = [
    playmobile.SMS(
        id="unique_string_1",
        sender="0001",
        recipient="998xx3332211",
        text="Hello world!",
    ),
    playmobile.SMS(
        id="unique_string_2",
        sender="0001",
        recipient="998xx3332211",
        text="Yankee!",
    ),
]
client.send_sms_batch(sms_batch)  
```

You can set up Timing settings:

```python
import playmobile

sms = playmobile.SMS(...)

timing = playmobile.Timing(
    start_at=datetime(2023, 1, 1, 12, 0),
    end_at=datetime(2023, 1, 1, 14, 0),
)

# Single SMS
client.send_sms(sms, timing=timing)
```

Advanced users can set up HTTPX session with custom parameters. For example:

```python
client = playmobile.Client(
    ...,
    session = httpx.Client(
        timeout=httpx.Timeout(timeout=2.0),
    ),
)
```

Package also have the test utils which will help you test your service:
- playmobile.generate_sms
- playmobile.generate_error

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/absolutionsuz/playmobile-client",
    "name": "playmobile-client",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "",
    "keywords": "playmobile,smsxabar,client,httpx,requests",
    "author": "Daniil Andreev",
    "author_email": "dandreevv22@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/51/29/f785e0ee3d432d1d7d41f16f07098d0108f3307d90954bdf702d12d91540/playmobile_client-1.0.0.tar.gz",
    "platform": null,
    "description": "# Python client for Playmobile.uz API (aka smsxabar.uz)\n\nThis is Python HTTP Client for [Playmobile.uz](https://playmobile.uz) (aka [smsxabar.uz](https://smsxabar.uz))\nbased on [httpx](https://github.com/encode/httpx).\n\nPlaymobile is a SMS broker which allows you to send messages throughout Uzbekistan.\n\n## Installation\n\nTo install playmobile-client, simply:\n\n``` bash\n$ pip install playmobile-client\n```\nThis package can be found on [PyPI](https://pypi.org/project/playmobile-client/).\n\n## Usage\n\n```python\nimport httpx\nimport playmobile\n\nclient = playmobile.HttpClient(\n    account=playmobile.Credentials(\n        username=\"example\",\n        password=\"example\",\n    ),\n    base_url=httpx.URL(\"https://playmobile-example.uz\"),\n    session=httpx.Client(),\n)\n\nsms = playmobile.SMS(\n    id=\"unique_string\",\n    sender=\"0001\",\n    recipient=\"998xx3332211\",\n    text=\"Hello world!\",\n)\n\n# Single SMS\nclient.send_sms(sms)\n\n# SMS batch\nsms_batch = [\n    playmobile.SMS(\n        id=\"unique_string_1\",\n        sender=\"0001\",\n        recipient=\"998xx3332211\",\n        text=\"Hello world!\",\n    ),\n    playmobile.SMS(\n        id=\"unique_string_2\",\n        sender=\"0001\",\n        recipient=\"998xx3332211\",\n        text=\"Yankee!\",\n    ),\n]\nclient.send_sms_batch(sms_batch)  \n```\n\nYou can set up Timing settings:\n\n```python\nimport playmobile\n\nsms = playmobile.SMS(...)\n\ntiming = playmobile.Timing(\n    start_at=datetime(2023, 1, 1, 12, 0),\n    end_at=datetime(2023, 1, 1, 14, 0),\n)\n\n# Single SMS\nclient.send_sms(sms, timing=timing)\n```\n\nAdvanced users can set up HTTPX session with custom parameters. For example:\n\n```python\nclient = playmobile.Client(\n    ...,\n    session = httpx.Client(\n        timeout=httpx.Timeout(timeout=2.0),\n    ),\n)\n```\n\nPackage also have the test utils which will help you test your service:\n- playmobile.generate_sms\n- playmobile.generate_error\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "Python client for Playmobile.uz API",
    "version": "1.0.0",
    "split_keywords": [
        "playmobile",
        "smsxabar",
        "client",
        "httpx",
        "requests"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1b9fd2bfa56a8f1119b11ce0135c3a120c3eab3029e13be3d18e6a2e4452f3cb",
                "md5": "05e5e3f3d564d0ca91e9bf3ff7717bee",
                "sha256": "b7dbcded4cd644e016498d09d80861887016f8eccd6c9bb8a5a0a8a09228aa20"
            },
            "downloads": -1,
            "filename": "playmobile_client-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "05e5e3f3d564d0ca91e9bf3ff7717bee",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 7812,
            "upload_time": "2023-01-18T18:12:12",
            "upload_time_iso_8601": "2023-01-18T18:12:12.280645Z",
            "url": "https://files.pythonhosted.org/packages/1b/9f/d2bfa56a8f1119b11ce0135c3a120c3eab3029e13be3d18e6a2e4452f3cb/playmobile_client-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5129f785e0ee3d432d1d7d41f16f07098d0108f3307d90954bdf702d12d91540",
                "md5": "0cfa07bcc1cbd6889221694bf9908e63",
                "sha256": "5f608c437f387be11187d627da6e1bb00ae28121c9abe511f8510eac0f320918"
            },
            "downloads": -1,
            "filename": "playmobile_client-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "0cfa07bcc1cbd6889221694bf9908e63",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 6877,
            "upload_time": "2023-01-18T18:12:14",
            "upload_time_iso_8601": "2023-01-18T18:12:14.342318Z",
            "url": "https://files.pythonhosted.org/packages/51/29/f785e0ee3d432d1d7d41f16f07098d0108f3307d90954bdf702d12d91540/playmobile_client-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-18 18:12:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "absolutionsuz",
    "github_project": "playmobile-client",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "playmobile-client"
}
        
Elapsed time: 0.03392s