# greensms-python
![GitHub release (latest by date)](https://img.shields.io/github/v/release/greensms-ru/greensms-python)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/greensms)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/greensms-ru/greensms-python/python-package.yml?branch=main)
![Coveralls github](https://img.shields.io/coveralls/github/greensms-ru/greensms-python)
## Documentation
The documentation for the GREENSMS API can be found [here][apidocs].
## Installation
```bash
pipenv install greensms
```
or
```bash
pip install greensms
```
## Sample Usage
Check out these [code examples](examples) to get up and running quickly.
```python
from greensms.client import GreenSMS
# Register at my.greensms.ru first
client = GreenSMS(user='test', password='test')
response = client.sms.send(to='71231234567', txt='Message to deliver')
print(response.request_id) # or print(response['request_id'])
```
### Environment Variables
`greensms-python` supports credential storage in environment variables. If no credentials are provided following env vars will be used: `GREENSMS_USER`/`GREENSMS_PASS` OR `GREENSMS_TOKEN`.
### Token Auth
```python
from greensms.client import GreenSMS
# Register at my.greensms.ru first
client = GreenSMS(token='yourtoken')
response = client.account.balance()
print(response.balance)
```
## Compatibility
`greensms-python` is compatible with Python 2.7 and Python 3.4 onwards until the latest Python 3.11 version
## Methods
- You can either use username/password combination or auth token to create an object with constructor
- All methods support named \*\*kwargs
- Each API Function is available as `MODULE.FUNCTION()`
- Parameters for each API can be referred from [here][apidocs]
- Response keys can be used as dictionary keys `response['key']` or properties `response.key`
- Response keys by default are available in `snake_case`. If you want to use `camelCase`, then pass `use_camel_case=true`, in the constructor
## Handling Exceptions
- Exceptions for all APIs are thrown with `RestError` class. It extends the default Python Exception class.
- Each error, will have `error`, `code`, `message`, `errorType` fields.
- In case of _Validation Error_, additional params are available to show field-wise rule failures. Can be accessed by `e.params` property on the error object
## Getting help
If you need help installing or using the library, please contact us: [support@greensms.ru](mailto:support@greensms.ru).
If you've instead found a bug in the library or would like new features added, go ahead and open issues or pull requests against this repo!
## Contributing
Bug fixes, docs, and library improvements are always welcome. Please refer to our [Contributing Guide](CONTRIBUTING.md) for detailed information on how you can contribute.
If you're not familiar with the GitHub pull request/contribution process, [this is a nice tutorial](https://gun.io/blog/how-to-github-fork-branch-and-pull-request/).
### Getting Started
If you want to familiarize yourself with the project, you can start by [forking the repository](https://help.github.com/articles/fork-a-repo/) and [cloning it in your local development environment](https://help.github.com/articles/cloning-a-repository/). The project requires [Node.js](https://nodejs.org) to be installed on your machine.
After cloning the repository, install the dependencies by running the following command in the directory of your cloned repository:
```bash
pip install -r requirements.txt
```
In addition to this, we recommend running the setup with [virtualenv](https://virtualenv.pypa.io/), for creating an isolated Python development environment.
GreenSMS has all the unit tests defined under **tests** folder with `_test.py` extension. Although it uses Python Unittest, we recommended that you test with [py.test](http://pytest.org/). PyTest supports Python unit tests out of the box and is faster for running the tests in bulk.
```bash
pytest tests
```
We also support [tox](https://tox.readthedocs.io/) for automate env/interpretor wise testing. Support versions are added to tox.ini. Dependencies added in root requirements.txt are supposed to be added to `tests/requirements.txt` as well.
You can install and run tox for the project with the following commands.
```bash
pip install tox # Install tox
tox # Run test
```
[apidocs]: https://api.greensms.ru/
Raw data
{
"_id": null,
"home_page": "https://github.com/greensms-ru/greensms-python",
"name": "greensms",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "greensms,sms,sms-api,call-for-code,rest,api,viber,whatsapp",
"author": "GreenSMS",
"author_email": "support@greensms.ru",
"download_url": "https://files.pythonhosted.org/packages/47/d1/58174f71c359d2d746f0939f8fca388e25c843c48833401f3f5b2d42a112/greensms-2.0.1.tar.gz",
"platform": null,
"description": "# greensms-python\n\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/greensms-ru/greensms-python)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/greensms)\n![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/greensms-ru/greensms-python/python-package.yml?branch=main)\n![Coveralls github](https://img.shields.io/coveralls/github/greensms-ru/greensms-python)\n\n## Documentation\n\nThe documentation for the GREENSMS API can be found [here][apidocs].\n\n## Installation\n\n```bash\npipenv install greensms\n```\n\nor\n\n```bash\npip install greensms\n```\n\n## Sample Usage\n\nCheck out these [code examples](examples) to get up and running quickly.\n\n```python\n\nfrom greensms.client import GreenSMS\n\n# Register at my.greensms.ru first\nclient = GreenSMS(user='test', password='test')\n\nresponse = client.sms.send(to='71231234567', txt='Message to deliver')\nprint(response.request_id) # or print(response['request_id'])\n\n```\n\n### Environment Variables\n\n`greensms-python` supports credential storage in environment variables. If no credentials are provided following env vars will be used: `GREENSMS_USER`/`GREENSMS_PASS` OR `GREENSMS_TOKEN`.\n\n### Token Auth\n\n```python\n\nfrom greensms.client import GreenSMS\n\n# Register at my.greensms.ru first\nclient = GreenSMS(token='yourtoken')\n\nresponse = client.account.balance()\nprint(response.balance)\n\n```\n\n## Compatibility\n\n`greensms-python` is compatible with Python 2.7 and Python 3.4 onwards until the latest Python 3.11 version\n\n## Methods\n\n- You can either use username/password combination or auth token to create an object with constructor\n- All methods support named \\*\\*kwargs\n- Each API Function is available as `MODULE.FUNCTION()`\n- Parameters for each API can be referred from [here][apidocs]\n- Response keys can be used as dictionary keys `response['key']` or properties `response.key`\n- Response keys by default are available in `snake_case`. If you want to use `camelCase`, then pass `use_camel_case=true`, in the constructor\n\n## Handling Exceptions\n\n- Exceptions for all APIs are thrown with `RestError` class. It extends the default Python Exception class.\n- Each error, will have `error`, `code`, `message`, `errorType` fields.\n- In case of _Validation Error_, additional params are available to show field-wise rule failures. Can be accessed by `e.params` property on the error object\n\n## Getting help\n\nIf you need help installing or using the library, please contact us: [support@greensms.ru](mailto:support@greensms.ru).\n\nIf you've instead found a bug in the library or would like new features added, go ahead and open issues or pull requests against this repo!\n\n## Contributing\n\nBug fixes, docs, and library improvements are always welcome. Please refer to our [Contributing Guide](CONTRIBUTING.md) for detailed information on how you can contribute.\nIf you're not familiar with the GitHub pull request/contribution process, [this is a nice tutorial](https://gun.io/blog/how-to-github-fork-branch-and-pull-request/).\n\n### Getting Started\n\nIf you want to familiarize yourself with the project, you can start by [forking the repository](https://help.github.com/articles/fork-a-repo/) and [cloning it in your local development environment](https://help.github.com/articles/cloning-a-repository/). The project requires [Node.js](https://nodejs.org) to be installed on your machine.\n\nAfter cloning the repository, install the dependencies by running the following command in the directory of your cloned repository:\n\n```bash\npip install -r requirements.txt\n```\n\nIn addition to this, we recommend running the setup with [virtualenv](https://virtualenv.pypa.io/), for creating an isolated Python development environment.\n\nGreenSMS has all the unit tests defined under **tests** folder with `_test.py` extension. Although it uses Python Unittest, we recommended that you test with [py.test](http://pytest.org/). PyTest supports Python unit tests out of the box and is faster for running the tests in bulk.\n\n```bash\npytest tests\n```\n\nWe also support [tox](https://tox.readthedocs.io/) for automate env/interpretor wise testing. Support versions are added to tox.ini. Dependencies added in root requirements.txt are supposed to be added to `tests/requirements.txt` as well.\n\nYou can install and run tox for the project with the following commands.\n\n```bash\npip install tox # Install tox\n\ntox # Run test\n\n```\n\n[apidocs]: https://api.greensms.ru/\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "GREENSMS API: SMS, Call, Voice, VK, WhatsApp, Viber, HLR, Pay",
"version": "2.0.1",
"split_keywords": [
"greensms",
"sms",
"sms-api",
"call-for-code",
"rest",
"api",
"viber",
"whatsapp"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "011ae3e638d1bd6fe6d05839314bf11490d61dc73bcc71afb66cbabb1b97d7ee",
"md5": "fbbd5f239b306cdbab5fc701d29141ce",
"sha256": "d0e74119c8390dd8ca6eb37aeb148cd400f562234d9e6d431256aa0007532154"
},
"downloads": -1,
"filename": "greensms-2.0.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "fbbd5f239b306cdbab5fc701d29141ce",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 12528,
"upload_time": "2023-03-24T21:28:27",
"upload_time_iso_8601": "2023-03-24T21:28:27.975467Z",
"url": "https://files.pythonhosted.org/packages/01/1a/e3e638d1bd6fe6d05839314bf11490d61dc73bcc71afb66cbabb1b97d7ee/greensms-2.0.1-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "47d158174f71c359d2d746f0939f8fca388e25c843c48833401f3f5b2d42a112",
"md5": "a9962b3a437b6ad2f05fcfdc5d506f3c",
"sha256": "1796caf5747b8f9957cbdae53bdc8b058a401204d989c2d73bf7288bb3285d0a"
},
"downloads": -1,
"filename": "greensms-2.0.1.tar.gz",
"has_sig": false,
"md5_digest": "a9962b3a437b6ad2f05fcfdc5d506f3c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 11685,
"upload_time": "2023-03-24T21:28:30",
"upload_time_iso_8601": "2023-03-24T21:28:30.164292Z",
"url": "https://files.pythonhosted.org/packages/47/d1/58174f71c359d2d746f0939f8fca388e25c843c48833401f3f5b2d42a112/greensms-2.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-24 21:28:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "greensms-ru",
"github_project": "greensms-python",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "greensms"
}