semaphore-sms


Namesemaphore-sms JSON
Version 1.0.0 PyPI version JSON
download
home_page
SummaryAPI wrapper for https://semaphore.co/
upload_time2023-12-16 12:20:01
maintainer
docs_urlNone
author
requires_python>=3.7.0
license
keywords semaphore semaphore ph semaphore sms
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # semaphore-sms

[![PyPI](https://img.shields.io/pypi/v/semaphore-sms.svg)](https://pypi.python.org/pypi/semaphore-sms)
[![PyPI](https://img.shields.io/pypi/pyversions/semaphore-sms.svg)](https://pypi.python.org/pypi/semaphore-sms)

API wrapper for [Semaphore SMS Gateway](https://semaphore.co/). The documentation for their API can be found [here](https://semaphore.co/docs).

## Installation

This library should be able to support Python versions >= 3.7.

Install from PyPi using [pip](https://pip.pypa.io/en/latest/) via

```shell
pip install semaphore-sms
```

Don't have pip installed? Refer to [this documentation](https://pip.pypa.io/en/stable/installation/)

## Usage

‼️ For all these calls, you can see sample responses in tests/test_semaphore_client.py ‼️

### Initializing the client

```python
from semaphore_sms import SemaphoreClient

client = SemaphoreClient(
    api_key='your_api_key',
    sender_name'sender_name',
)
```

> Note: `SemaphoreClient` will try to pull `api_key` from `os.environ` if not supplied. If it still can't a value then, a `SemaphoreException` will be raised

### Sending SMS

For sending [a basic single message](https://semaphore.co/docs#sending_messages),

```python
client.send(
    message='Your text here',
    recipients=['09980101010', ]
)
```

To send one message [to several numbers in bulk](https://semaphore.co/docs#sending_messages), simply provide multiple numbers under `recipients`

```python
client.send(
    message='Your text here',
    recipients=['09980101010', '09980202020', ]
)
```

Sending out [priority messages](https://semaphore.co/docs#sending_messages) and [OTP messages](https://semaphore.co/docs#sending_messages) will look very similar

```python
client.priority(
    message='Your text here',
    recipients=['09980101010', '09980202020', ]
)

client.otp(
    message='Your OTP is: {otp}',  # refer to Semaphore's docs for details
    recipients=['09980101010', ],
    code=123456,  # refer to Semaphore's docs for details
)
```

### Fetching messages

https://semaphore.co/docs#retrieving_messages

```python
client.messages(
    limit=100,  # optional
    page=1,  # optional
    start_date='2023-11-06',  # optional
    end_date='2023-12-25',  # optional
    network='smart',  # optional
    status='succcess'  # optional
)
```

### Retrieving account information

https://semaphore.co/docs#retrieving_account

```python
account_information = client.account
transactions = client.transactions(
    limit=100,  # optional
    page=1  # optional
)
sender_names = client.sender_names(
    limit=100,  # optional
    page=1  # optional
)
users = client.users(
    limit=100,  # optional
    page=1  # optional
)
```

Again, you can see sample responses in tests/test_semaphore_client.py

## Tests

Clone the repo and run

```shell
PYTHONPATH=src python -m unittest
```

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/sbenemerito/semaphore-sms/

## License

The library is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "semaphore-sms",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7.0",
    "maintainer_email": "",
    "keywords": "semaphore,semaphore ph,semaphore sms",
    "author": "",
    "author_email": "Sam Benemerito <sbbenemerito@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/e1/f9/cb3a713b2033f25508aede699e62d35e49fb0c27fade2e5e2df123be4b6e/semaphore_sms-1.0.0.tar.gz",
    "platform": null,
    "description": "# semaphore-sms\n\n[![PyPI](https://img.shields.io/pypi/v/semaphore-sms.svg)](https://pypi.python.org/pypi/semaphore-sms)\n[![PyPI](https://img.shields.io/pypi/pyversions/semaphore-sms.svg)](https://pypi.python.org/pypi/semaphore-sms)\n\nAPI wrapper for [Semaphore SMS Gateway](https://semaphore.co/). The documentation for their API can be found [here](https://semaphore.co/docs).\n\n## Installation\n\nThis library should be able to support Python versions >= 3.7.\n\nInstall from PyPi using [pip](https://pip.pypa.io/en/latest/) via\n\n```shell\npip install semaphore-sms\n```\n\nDon't have pip installed? Refer to [this documentation](https://pip.pypa.io/en/stable/installation/)\n\n## Usage\n\n\u203c\ufe0f For all these calls, you can see sample responses in tests/test_semaphore_client.py \u203c\ufe0f\n\n### Initializing the client\n\n```python\nfrom semaphore_sms import SemaphoreClient\n\nclient = SemaphoreClient(\n    api_key='your_api_key',\n    sender_name'sender_name',\n)\n```\n\n> Note: `SemaphoreClient` will try to pull `api_key` from `os.environ` if not supplied. If it still can't a value then, a `SemaphoreException` will be raised\n\n### Sending SMS\n\nFor sending [a basic single message](https://semaphore.co/docs#sending_messages),\n\n```python\nclient.send(\n    message='Your text here',\n    recipients=['09980101010', ]\n)\n```\n\nTo send one message [to several numbers in bulk](https://semaphore.co/docs#sending_messages), simply provide multiple numbers under `recipients`\n\n```python\nclient.send(\n    message='Your text here',\n    recipients=['09980101010', '09980202020', ]\n)\n```\n\nSending out [priority messages](https://semaphore.co/docs#sending_messages) and [OTP messages](https://semaphore.co/docs#sending_messages) will look very similar\n\n```python\nclient.priority(\n    message='Your text here',\n    recipients=['09980101010', '09980202020', ]\n)\n\nclient.otp(\n    message='Your OTP is: {otp}',  # refer to Semaphore's docs for details\n    recipients=['09980101010', ],\n    code=123456,  # refer to Semaphore's docs for details\n)\n```\n\n### Fetching messages\n\nhttps://semaphore.co/docs#retrieving_messages\n\n```python\nclient.messages(\n    limit=100,  # optional\n    page=1,  # optional\n    start_date='2023-11-06',  # optional\n    end_date='2023-12-25',  # optional\n    network='smart',  # optional\n    status='succcess'  # optional\n)\n```\n\n### Retrieving account information\n\nhttps://semaphore.co/docs#retrieving_account\n\n```python\naccount_information = client.account\ntransactions = client.transactions(\n    limit=100,  # optional\n    page=1  # optional\n)\nsender_names = client.sender_names(\n    limit=100,  # optional\n    page=1  # optional\n)\nusers = client.users(\n    limit=100,  # optional\n    page=1  # optional\n)\n```\n\nAgain, you can see sample responses in tests/test_semaphore_client.py\n\n## Tests\n\nClone the repo and run\n\n```shell\nPYTHONPATH=src python -m unittest\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/sbenemerito/semaphore-sms/\n\n## License\n\nThe library is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "API wrapper for https://semaphore.co/",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/sbenemerito/semaphore-sms",
        "Issues": "https://github.com/sbenemerito/semaphore-sms/issues",
        "Semaphore SMS Gateway": "https://semaphore.co/"
    },
    "split_keywords": [
        "semaphore",
        "semaphore ph",
        "semaphore sms"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c437e7481ce7ec5f049ae4578da1f617308417f43c91978bd9a91159eddaf067",
                "md5": "febc6e3dd09c832b23ed2cedc4cda560",
                "sha256": "2ee717aaa198f2a6ecd56a30b6d6b30339d8ec759ec947a5d8182a3c8f81fd15"
            },
            "downloads": -1,
            "filename": "semaphore_sms-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "febc6e3dd09c832b23ed2cedc4cda560",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7.0",
            "size": 7706,
            "upload_time": "2023-12-16T12:19:58",
            "upload_time_iso_8601": "2023-12-16T12:19:58.969699Z",
            "url": "https://files.pythonhosted.org/packages/c4/37/e7481ce7ec5f049ae4578da1f617308417f43c91978bd9a91159eddaf067/semaphore_sms-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e1f9cb3a713b2033f25508aede699e62d35e49fb0c27fade2e5e2df123be4b6e",
                "md5": "dcbd355ec2797d443fdb94348347778c",
                "sha256": "a2fad52c2c53ec89e20712d4a71259f1cd14f053a9cba3c70b3f14cdab250131"
            },
            "downloads": -1,
            "filename": "semaphore_sms-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "dcbd355ec2797d443fdb94348347778c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7.0",
            "size": 10321,
            "upload_time": "2023-12-16T12:20:01",
            "upload_time_iso_8601": "2023-12-16T12:20:01.291652Z",
            "url": "https://files.pythonhosted.org/packages/e1/f9/cb3a713b2033f25508aede699e62d35e49fb0c27fade2e5e2df123be4b6e/semaphore_sms-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-16 12:20:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sbenemerito",
    "github_project": "semaphore-sms",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "semaphore-sms"
}
        
Elapsed time: 0.15429s