{ "info": { "author": "Nicolas Pottier, Eric Newcomer", "author_email": "code@nyaruka.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "RapidSMS HTTP Router\n====================\n\nImplements HTTP endpoints to allow for the RapidSMS 'routing' process to be done in the HTTP thread.\n\n**Distinct features**\n\n- All message handling is done in the Django HTTP thread\n- Easy 'AJAX' endpoints for receiving messages, marking messages as delivered and getting the current outbox\n- Supports either queueing messages in the DB to be sent off by an outside process (pull) or sending messages to a configured URL. (push)\n- Includes a simple HTTP console web application that integrates with RapidSMS\n- \"play alike\" implementation with RapidSMS, no changes needed to existing applications\n- Easy and reliable standalone integration with Kannel\n\nThe official source code repository is:\n http://www.github.com/nyaruka/rapidsms-httprouter\n\nBuilt by Nyaruka Ltd:\n http://www.nyaruka.com\n\nContributions by UNICEF Uganda:\n http://www.unicef.org\n\nCaveats\n-------\n\nSince this obviously does things differently, some things break. Specifically the following apps will no longer work and should be removed from your ``INSTALLED_APPS`` and ``RAPIDSMS_TABS``::\n\n rapidsms.contrib.messagelog\n rapidsms.contrib.httptester\n rapidsms.contrib.ajax\n\nThe HTTP Router app replaces most of the functionality provided by these packages. Specifically all messages passing through the HTTP router will be logged automatically and it provides a web interface for viewing and submitting new messages.\n\nInstallation From Cheese Shop\n=============================\n\nYou can install the latest version of the rapidsms-httprouter library straight from the cheese shop::\n\n % pip install rapidsms-httprouter\n\nInstallation From Github\n========================\n\nYou can always get the latest version of rapidsms-httprouter from github. Note that the tip of the repo is not guaranteed to be stable. You should use the verison available via pip unless you have a specific reason not to.\n\nYou can install the requirements using the ``pip-requires.txt`` file::\n\n % pip install -r pip-requires.txt\n\nConfiguration\n=============\n\nPut ``rapidsms_httprouter`` in your path, then add it to your ``INSTALLED_APPS`` setting::\n\n INSTALLED_APPS = [\n \"rapidsms\",\n ..\n ..\n \"rapidsms_httprouter\"\n ]\n\nAnd add it to your project's urls.py::\n\n urlpatterns = patterns('',\n .. other url patterns ..\n ('', include('rapidsms_httprouter.urls'))\n )\n\nrapidsms-httprouter also only pulls in the applications you specify for SMS handling. This lets you use the models from an existing SMS application. So you'll need to add an ``SMS_APPS`` list to your settings.py::\n\n SMS_APPS = [\n \"mysms.coolapp\",\n ]\n\nFinally, if you want to have the router push messages to a specific URL when they are sent, you need to specify that in the settings.py as well::\n\n ROUTER_URL = \"http://backend.server.com/send?backend=%(backend)s&recipient=%(recipient)s&text=%(text)s\"\n\nThe following fields will be substituted into that string and the resulting URL will then be called via an HTTP GET::\n\n 'backend': the backend that is sending this message\n 'recipient': the phone number to send to\n 'text': the text to send \n 'id': the internal rapidsms id for this message\n\nIf you want to use the included console and http tester, add it as a tab::\n\n RAPIDSMS_TABS = [\n ..\n (\"httprouter-console\", \"Console\"),\n ]\n\nUsage\n=====\n\nIf you installed the tab, you should be able to click on the Console tab and immediately begin sending messages. Note that you do not need to run the router process for this to work, instead the HTTP backend detects that there is no router and queues the messages for sending later. (the 'Q' status represents this)\n\nIn your app.py, httprouter-aware applications can make use of an extra attribute that will be added to the IncomingMessage object, 'db_message'. This is a reference to the actual database-persisted message::\n\n def handle (self, message):\n if hasattr(message, 'db_message'):\n # do something cool, like add the message as a foreign key\n # to one of your app's models, so you know where the model\n # originated\n\nEndpoints\n=========\n\nThe HTTP router provides the following endpoints:\n\nReceive\n-------\n\nMessages can be handled and put through the router process using the URL, the result is json::\n \n /router/receive?backend=&sender=&message=\n\n\nOutbox\n------\n\nYou can see any pending messages which need to be sent using the URL, the result is json::\n\n /router/outbox\n\n\nDelivered\n---------\n\nYou can mark a message as sent, or delivered usign the URL::\n\n /router/delivered?message_id=\n\nKannel Integration\n==================\n\nRapidSMS-HttpRouter works especially well when used with a standalone Kannel configuration. You just need to configure it to send messages in the format Kannel expects and vice versa.\n\nIn your settings.py set your ROUTER_URL like so, adjusting appropriately based on your Kannel configuration::\n\n ROUTER_URL = \"http://localhost:13013/cgi-bin/sendsms?from=123&username=kannel&password=kannel&text=%(text)s&to=%(recipient)s&smsc=%(backend)s&dlr_url=http%%3A%%2F%%2Fmyrapid.com%%2Frouter%%2Fdelivered%%2F%%3Fmessage_id%%3D%(id)s\"\n\nThe important thing to note here is the dlr_url parameter, which while optional, lets you get delivery reports and mark messages as not just sent but actually delivered according to the SMSC.\n\nA basic Kannel sms-service configuration that would work for this might be::\n\n group = sms-service\n keyword = default\n max-messages = 0 \n get-url = \"http://myrapid.com/router/receive/?backend=%i&sender=%p&message=%b\"\n allowed-receiver-prefix = 123;+123\n concatenation = true\n assume-plain-text = true\n accept-x-kannel-headers = true\n omit-empty = true\n\nMultiple Backends\n=================\n\nNote that if you have multiple backends, you can set your ROUTER_URL setting to map between backend names and URLs, ie::\n\n ROUTER_URL = {\n 'tigo': 'http://kannel.tigo.com/cgi-bin/sendsms?from=123&username=kannel&password=kannel&text=%(text)s&to=%(recipient)s&smsc=%(backend)s',\n\t'default': 'http://kannel.mtn.com/cgi-bin/sendsms?from=123&username=kannel&password=kannel&text=%(text)s&to=%(recipient)s&smsc=%(backend)s',\n }\n\nNote that you must either have one entry per backend, or include a 'default' element, which will be used whenever there is not a specific match.\n\nSecurity\n========\n\nIt is a good idea to have some security on who can deliver messages to your system, who can see the outbox and who can can mark messages as delivered. You can lock these down in a rudimentary fashion by settings the ROUTER_PASSWORD attribute in your settings.py::\n\n ROUTER_PASSWORD = \"landshark\"\n\nAny incoming requests to those endpoints will fail if it is not included.\n\nCelery & Redis\n===============\n\nHttpRouter has two dependencies if you plan on using a ROUTER_URL and not just have message queue up, Redis and Celery. (note you can use Redis as a backend for Celery) You'll need something like the following your settings.py in order to get things working::\n\n #-----------------------------------------------------------------------------------\n # Async tasks with django-celery\n #-----------------------------------------------------------------------------------\n\n import djcelery\n djcelery.setup_loader()\n\n CELERY_RESULT_BACKEND = 'database'\n\n BROKER_BACKEND = 'redis'\n BROKER_HOST = 'localhost'\n BROKER_PORT = 6379\n BROKER_VHOST = '1'\n\n REDIS_PORT=6379\n REDIS_HOST='localhost'\n REDIS_DB=1\n\n #-----------------------------------------------------------------------------------\n # Crontab Schedule\n #-----------------------------------------------------------------------------------\n\n from datetime import timedelta\n\n CELERYBEAT_SCHEDULE = {\n \"runs-every-five-minutes\": {\n 'task': 'rapidsms_httprouter.tasks.resend_errored_messages_task',\n 'schedule': timedelta(minutes=1),\n },\n }", "description_content_type": null, "docs_url": null, "download_url": "http://github.com/nyaruka/rapidsms-httprouter/downloads", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/nyaruka/rapidsms-httprouter", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "rapidsms-httprouter", "package_url": "https://pypi.org/project/rapidsms-httprouter/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/rapidsms-httprouter/", "project_urls": { "Download": "http://github.com/nyaruka/rapidsms-httprouter/downloads", "Homepage": "http://github.com/nyaruka/rapidsms-httprouter" }, "release_url": "https://pypi.org/project/rapidsms-httprouter/2.0.4/", "requires_dist": null, "requires_python": null, "summary": "Provides HTTP endpoints for a RapidSMS router, doing all handling in the Django thread.", "version": "2.0.4" }, "last_serial": 5608176, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "163e7a91d5d971daa457a443f6005730", "sha256": "717b829919124039098c529be748424858279950db76f32b6b4b995126399532" }, "downloads": -1, "filename": "rapidsms-httprouter-0.2.0.tar.gz", "has_sig": false, "md5_digest": "163e7a91d5d971daa457a443f6005730", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12250, "upload_time": "2010-12-13T12:40:46", "url": "https://files.pythonhosted.org/packages/8c/2c/5170b9037808bafe278ff173a1a1ad2034dcbf15ce3417c794d3c54df0bc/rapidsms-httprouter-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "4f0b42c731ea7fbee696042009d4410b", "sha256": "86bc528bbd2cf708c6bbe3a4841259ad02d8cea5ab447fa34c48d2208ab037e2" }, "downloads": -1, "filename": "rapidsms-httprouter-0.2.1.tar.gz", "has_sig": false, "md5_digest": "4f0b42c731ea7fbee696042009d4410b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12241, "upload_time": "2010-12-13T12:46:49", "url": "https://files.pythonhosted.org/packages/85/97/8f0d1b49b9f81ddaebc363749aa739d1c703d92317e717ce26262ea0ca34/rapidsms-httprouter-0.2.1.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "2acf25ad601ada7c0a333b0f8ec55453", "sha256": "fbd77dcac823c36f2e930803575a827630df372e7a0ef47d3d3b102ac4049e21" }, "downloads": -1, "filename": "rapidsms-httprouter-0.3.0.tar.gz", "has_sig": false, "md5_digest": "2acf25ad601ada7c0a333b0f8ec55453", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12832, "upload_time": "2011-02-17T10:36:07", "url": "https://files.pythonhosted.org/packages/2c/45/69f6669c3c3db8f8775f3a36ad4c10ec22d05bd7e848c4224734522d37dd/rapidsms-httprouter-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "11b4b8c4707e71596156c2ebcf7590f9", "sha256": "c9ea1547437292a44946c5455e8b1931723199aad63db50fc48d6d6da609baed" }, "downloads": -1, "filename": "rapidsms-httprouter-0.4.0.tar.gz", "has_sig": false, "md5_digest": "11b4b8c4707e71596156c2ebcf7590f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22422, "upload_time": "2012-01-30T16:36:38", "url": "https://files.pythonhosted.org/packages/58/fb/e0779ce2ba4d64949df8e9bd77e65ee946351c784304a72eab25d351b745/rapidsms-httprouter-0.4.0.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "bc9b2ae96dfeb2b81362fdd9e417deed", "sha256": "c600132e04d77ff2f9db55531604765769eb64db782751dec4ac290d5dd6f257" }, "downloads": -1, "filename": "rapidsms-httprouter-0.5.0.tar.gz", "has_sig": false, "md5_digest": "bc9b2ae96dfeb2b81362fdd9e417deed", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19475, "upload_time": "2012-03-20T05:30:08", "url": "https://files.pythonhosted.org/packages/c1/91/ee71a224cbf3e19ebd200d540e2985db80120d704b64a62d4c790ae335e6/rapidsms-httprouter-0.5.0.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "882b3499b308ec18a6cbbcbf69fe3634", "sha256": "94c917a64bdca0aba2648cb7adc690d96afe9e1e7ed409211ffeb1b132b2b87a" }, "downloads": -1, "filename": "rapidsms-httprouter-0.5.1.tar.gz", "has_sig": false, "md5_digest": "882b3499b308ec18a6cbbcbf69fe3634", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23295, "upload_time": "2012-06-18T12:30:40", "url": "https://files.pythonhosted.org/packages/c0/c4/d7c230f6be011bf5561dd240559b5494c069de443e53edf91378bb6f1beb/rapidsms-httprouter-0.5.1.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "2620c38a2769cb152204cd311bed6735", "sha256": "177adc8b5c06403464028ca5f1c8d25a35d8c3f170c015049a63d87f615f392b" }, "downloads": -1, "filename": "rapidsms-httprouter-0.5.2.tar.gz", "has_sig": false, "md5_digest": "2620c38a2769cb152204cd311bed6735", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23339, "upload_time": "2012-06-21T16:57:37", "url": "https://files.pythonhosted.org/packages/92/fd/0b0126957d8c999032cc2395c6dc8c10d26d9fea56032cbba92ed884ef05/rapidsms-httprouter-0.5.2.tar.gz" } ], "2.0.1": [ { "comment_text": "", "digests": { "md5": "bca8fb0adbf436669a603891bf11c34d", "sha256": "9639feebf1872b507364c1ba1f8e2a3dc6af199c5d85a359ae366aa66501dd09" }, "downloads": -1, "filename": "rapidsms-httprouter-2.0.1.tar.gz", "has_sig": false, "md5_digest": "bca8fb0adbf436669a603891bf11c34d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22396, "upload_time": "2012-10-09T09:18:41", "url": "https://files.pythonhosted.org/packages/70/dc/70009523c560f1a892af495777633fc07e5bec26bb69e88889aeafd008ac/rapidsms-httprouter-2.0.1.tar.gz" } ], "2.0.2": [ { "comment_text": "", "digests": { "md5": "1bc46f11a22d6799e21a189c52a6e189", "sha256": "37b202eec55abdc2ef787a16219f7e8b99979e9bc0b900f91fc0407d4ea8826b" }, "downloads": -1, "filename": "rapidsms-httprouter-2.0.2.tar.gz", "has_sig": false, "md5_digest": "1bc46f11a22d6799e21a189c52a6e189", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26128, "upload_time": "2012-10-09T09:24:34", "url": "https://files.pythonhosted.org/packages/c1/b1/35a1056f859baa6b29af357189ff4ab00b12f423bdb9537f27f69d372dbd/rapidsms-httprouter-2.0.2.tar.gz" } ], "2.0.3": [ { "comment_text": "", "digests": { "md5": "bcc61294938cc02944385f20c9bcf3c1", "sha256": "53f08f630798b8b16d41adef3e1d25bc5a67952094ee6b1c3225650a88c7a8e4" }, "downloads": -1, "filename": "rapidsms-httprouter-2.0.3.tar.gz", "has_sig": false, "md5_digest": "bcc61294938cc02944385f20c9bcf3c1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26148, "upload_time": "2012-10-16T10:29:34", "url": "https://files.pythonhosted.org/packages/0c/ba/22a447deb86997340dce4fd9ba874350aaa3017fbd6b7c80cab011dbedae/rapidsms-httprouter-2.0.3.tar.gz" } ], "2.0.4": [ { "comment_text": "", "digests": { "md5": "357b5a86dbb4219699f6719c402f39b1", "sha256": "c438d5e5bddf738f908acc0c4f03b8e3a2d68974c9d344bfc72c7078db550c42" }, "downloads": -1, "filename": "rapidsms-httprouter-2.0.4.tar.gz", "has_sig": false, "md5_digest": "357b5a86dbb4219699f6719c402f39b1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26471, "upload_time": "2012-10-17T10:59:46", "url": "https://files.pythonhosted.org/packages/21/5b/efff937b27c7d5db1eeabf8c58d29c00825f6c10c9c92f35a7108d3dbd92/rapidsms-httprouter-2.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "357b5a86dbb4219699f6719c402f39b1", "sha256": "c438d5e5bddf738f908acc0c4f03b8e3a2d68974c9d344bfc72c7078db550c42" }, "downloads": -1, "filename": "rapidsms-httprouter-2.0.4.tar.gz", "has_sig": false, "md5_digest": "357b5a86dbb4219699f6719c402f39b1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26471, "upload_time": "2012-10-17T10:59:46", "url": "https://files.pythonhosted.org/packages/21/5b/efff937b27c7d5db1eeabf8c58d29c00825f6c10c9c92f35a7108d3dbd92/rapidsms-httprouter-2.0.4.tar.gz" } ] }