{ "info": { "author": "W&Z FinTech GmbH", "author_email": "dk@ownly.de", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Topic :: Utilities" ], "description": "sms_plusserver\n==============\n\nPython library that allows to send messages using Plusserver SMS platform.\n\n\nInstallation\n------------\n\n```\npip install sms_plusserver\n```\n\n\nUsage\n-----\n\nIn order to use this library users need to have an account on\nPlusserver SMS platform (https://sms.openit.de/).\n\n#### Quick start\n\n`sms_plusserver` provides module-level convenience functions to make sending\nmessages easier:\n\n```python\nfrom sms_plusserver import configure, send_sms\n\n# Configure service:\nconfigure(username='user', password='pass')\n\n# Send a message:\nsend_sms('+4911122233344', 'Hello!')\n```\n\n#### Configuration\n\n`configure` function allows to set all configuration options. These options\nwill be used by other functions / classes of the module by default.\n\n```python\n\nfrom sms_plusserver import configure\n\nconfigure(\n # Your Plusserver credentials (required):\n username='user',\n password='pass',\n # Optional parameters:\n project='MyAppNotifications', # Name of your app / project\n orig='MyApp', # SMS origin (name or phone number)\n encoding='utf-8', # Set default text encoding\n max_parts=3, # Send multiple messages when text exceeds 160 character limit\n timeout=60 # Default timeout for service API calls\n)\n```\n\n#### Sending messages\n\nThe easiest way to send a message is to call `send_sms` function:\n\n```python\n>>> from sms_plusserver import send_sms\n\n>>> send_sms('+4911122233344', 'Hello!')\n'a1d0c6e83f027327d8461063f4ac58a6' # Handle ID - unique message identifier\n```\n\nUser can provide sender name or number in `orig` parameter:\n```python\nsend_sms('+4911122233344', 'Hello!', orig='+4955544433300')\n```\n\nMessages on Plusserver platform can be tagged using `project` param:\n```python\nsend_sms('+4911122233344', 'Hello!', project='MyProject')\n```\n\nBy default all messages receive unique identifiers - \"Handle ID\".\nThis identifier allows user to check message status.\nTo send unregistered message user can set `registered_delivery` parameter\nto `False`:\n```python\n>>> from sms_plusserver import send_sms\n\n>>> send_sms('+4911122233344', 'Hello!', registered_delivery=False)\nTrue # No \"Handle ID\", just True (message sent) or False (error)\n```\n\nIn order to test SMS service without sending actual message, user can set\n`debug` parameter to `True`. Debug messages will not receive \"Handle ID\":\n```python\nsend_sms('+4911122233344', 'Hello!', debug=True)\n```\n\nAll API calls are made using HTTP requests to Plusserver web API. User can\nspecify network timeout for each request:\n```python\nsend_sms('+4911122233344', 'Hello!', timeout=30)\n```\n\nTo silence exceptions raised due to network errors or errors returned from\nprovider's API, user can set `fail_silently` parameter to `True`:\n```python\nsend_sms('+4911122233344', 'Hello!', fail_silently=True)\n```\n\nIn this case, `send_sms` function will return `None` when error occurs.\n\n\n#### Checking state of a message\n\nTo check status of a message with given \"Handle ID\" user can call\n`check_sms_state` function:\n\n```python\n>>> from sms_plusserver import check_sms_state\n\n>>> check_sms_state('a1d0c6e83f027327d8461063f4ac58a6')\n'arrived' # alternatively: \"new\" or \"processed\"\n```\n\nSimilar to `send_sms`, `check_sms_state` accepts also `fail_silently` and\n`timeout` parameters:\n```python\ncheck_sms_state('a1d0c6e83f027327d8461063f4ac58a6', timeout=30,\n fail_silently=True)\n```\n\n#### Waiting for a message to arrive\n\nIn order to wait for the message to arrive user can use `wait_until_arrived`\nfunction:\n\n```python\n>>> from sms_plusserver import wait_until_arrived\n\n>>> wait_until_arrived('a1d0c6e83f027327d8461063f4ac58a6')\n'arrived' # alternatively: \"new\" or \"processed\"\n```\nThis function continuously checks state of given message until the service\nresponds with \"arrived\" status.\n`wait_until_arrived` receives the same parameters as `send_sms_state`, but\nmeaning of `timeout` is a bit different - timeout is handled as total number\nof seconds to wait for a message to arrive. Without explicit timeout,\nthis function can wait forever.\n```python\ncheck_sms_state('a1d0c6e83f027327d8461063f4ac58a6', timeout=120)\n```\n\n\n#### Using Object-Oriented API\n\nAll functions of `sms_plusserver` package can be accessed using object-oriented\nAPI - `SMS` class:\n```python\n>>> from sms_plusserver import SMS\n\n>>> sms = SMS('+4911122233344', 'Hello!')\n>>> sms.send()\n'a1d0c6e83f027327d8461063f4ac58a6'\n>>> sms.check_state()\n'arrived'\n```\n\n\"Handle ID\" and message state can be examined using `handle_id` and `state`\nproperties:\n```python\n>>> from sms_plusserver import SMS\n\n>>> sms = SMS('+4911122233344', 'Hello!')\n>>> sms.handle_id\nNone\n>>> sms.send()\n>>> sms.handle_id\n'a1d0c6e83f027327d8461063f4ac58a6'\n>>> sms.state\nNone\n>>> sms.check_state()\n>>> sms.state\n'arrived'\n```\n\nAll parameters available in module-level functions are also valid for\nmethods of `SMS` class:\n\n```python\n>>> from sms_plusserver import SMS\n\n>>> sms = SMS('+4911122233344', 'Hello!')\n>>> sms.send(fail_silently=True)\n'a1d0c6e83f027327d8461063f4ac58a6'\n>>> sms.check_state(wait=True, timeout=120) # Equivalent of `wait_until_arrived`\n'arrived'\n```\n\n\n#### Multiple configurations\n\n`sms_plusserver` supports global and local configurations.\nBy default, module level functions and classes use global configuration\n(`sms_plusserver.default_service`) which can be altered using `configure` function.\nTo create independent configurations user can create new instance of `SMSService`\nclass and pass it to module-level functions or methods of `SMS` class\nas `service` parameter:\n\n```python\n>>> from sms_plusserver import check_sms_state, SMS, SMSService\n>>> service = SMSService(username='user', password='password', project='MyProject')\n>>> sms = SMS('+4911122233344', 'Hello!')\n>>> sms.send(service=service)\n'a1d0c6e83f027327d8461063f4ac58a6'\n>>> check_sms_state('a1d0c6e83f027327d8461063f4ac58a6', service=service)\n'arrived'\n```\n\n#### SMS Response objects\n\nAll technical parameters returned by Plusserver API calls, can be inspected\nby using `put_response` and `state_response` attributes of `SMS` objects.\n\n#### Exceptions\n\n`sms_plusserver` calls may raise the following exceptions:\n\n* `ConfigurationError`: Service is improperly configured.\n* `ValidationError`: Client-side error\n* `CommunicationError`: Unable to communicate to API\n* `RequestError`: API responded with an error\n\nRequirements\n------------\n\n* Python 2.7+\n* Python 3.5+\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/W-Z-FinTech-GmbH/sms_plusserver", "keywords": "s,m,s, ,p,l,u,s,s,e,r,v,e,r, ,m,e,s,s,a,g,e, ,t,e,x,t, ,p,h,o,n,e", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "sms-plusserver", "package_url": "https://pypi.org/project/sms-plusserver/", "platform": "", "project_url": "https://pypi.org/project/sms-plusserver/", "project_urls": { "Homepage": "https://github.com/W-Z-FinTech-GmbH/sms_plusserver" }, "release_url": "https://pypi.org/project/sms-plusserver/0.2.0/", "requires_dist": [ "requests (>=2.1)", "six" ], "requires_python": "", "summary": "Python library that allows to send messages using Plusserver SMS platform.", "version": "0.2.0" }, "last_serial": 3596670, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "2ed6252838aa9cd845ba14160b9fd134", "sha256": "469672fa4118487b4d72b54bc84fac9dbbcf46c23a468911a6f3ebdbaea0c08d" }, "downloads": -1, "filename": "sms_plusserver-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2ed6252838aa9cd845ba14160b9fd134", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10461, "upload_time": "2017-10-14T22:50:53", "url": "https://files.pythonhosted.org/packages/9b/fe/5b90bad5a5adaaf244467680f64f0b16867e4f44b90e6bdd131ad95f4acf/sms_plusserver-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cff874ff6daa704602fe158cc2cd44c7", "sha256": "646b99500a0706dfcdebadcbe2ff76e271a30f08a9ecf1f96e527dc230c8a89b" }, "downloads": -1, "filename": "sms_plusserver-0.1.1.tar.gz", "has_sig": false, "md5_digest": "cff874ff6daa704602fe158cc2cd44c7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7734, "upload_time": "2017-10-14T22:50:57", "url": "https://files.pythonhosted.org/packages/6a/d2/286e39e1f082503cf0ad80076860360ff20d9b33a1da9406552ed1998f82/sms_plusserver-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "39f4243f956b4f036928463a0aab28cc", "sha256": "26103a34e48f778d8c8f2092d57a4f1620be5b2319ca11d1655a04fc52d220cd" }, "downloads": -1, "filename": "sms_plusserver-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "39f4243f956b4f036928463a0aab28cc", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10884, "upload_time": "2018-02-19T17:58:56", "url": "https://files.pythonhosted.org/packages/3d/a1/28ff17ac5434d9802941456329f4dd93fa750d8471d417f56a6dbdb08651/sms_plusserver-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "93c7f840de08eb65ec03aabc509d8121", "sha256": "3208dcd7326ba490aec370041fc31c522e0ca2b9fcb6a353ed40f43767657e7a" }, "downloads": -1, "filename": "sms_plusserver-0.2.0.tar.gz", "has_sig": false, "md5_digest": "93c7f840de08eb65ec03aabc509d8121", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8604, "upload_time": "2018-02-19T17:58:58", "url": "https://files.pythonhosted.org/packages/0f/2a/ca08902ce3f07e5103e34a1deb66b6ce26846db29b39f4ee1270207b017b/sms_plusserver-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "39f4243f956b4f036928463a0aab28cc", "sha256": "26103a34e48f778d8c8f2092d57a4f1620be5b2319ca11d1655a04fc52d220cd" }, "downloads": -1, "filename": "sms_plusserver-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "39f4243f956b4f036928463a0aab28cc", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10884, "upload_time": "2018-02-19T17:58:56", "url": "https://files.pythonhosted.org/packages/3d/a1/28ff17ac5434d9802941456329f4dd93fa750d8471d417f56a6dbdb08651/sms_plusserver-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "93c7f840de08eb65ec03aabc509d8121", "sha256": "3208dcd7326ba490aec370041fc31c522e0ca2b9fcb6a353ed40f43767657e7a" }, "downloads": -1, "filename": "sms_plusserver-0.2.0.tar.gz", "has_sig": false, "md5_digest": "93c7f840de08eb65ec03aabc509d8121", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8604, "upload_time": "2018-02-19T17:58:58", "url": "https://files.pythonhosted.org/packages/0f/2a/ca08902ce3f07e5103e34a1deb66b6ce26846db29b39f4ee1270207b017b/sms_plusserver-0.2.0.tar.gz" } ] }