{ "info": { "author": "jtmoulia", "author_email": "jtmoulia@pocketknife.io", "bugtrack_url": null, "classifiers": [], "description": "==================\nSwitchboard Python\n==================\n\nSwitchboard_ Python provides helpers for writing Switchboard workers\nand clients in Python.\n\n.. _Switchboard: http://thusfresh.github.io/switchboard\n\n\nInstallation\n============\n\nIt's simplest to install this library from [PyPi](https://pypi.python.org/pypi):\n\n pip install switchboard-python\n\nTo build from source:\n\n # Building\n ./setup.py build\n\n # Running the tests\n ./setup.py test\n\n # Development install\n pip install -e .\n\n # Actual install\n pip install .\n\n\nUsage\n=====\n\nThe :code:`switchboard.Client` class is used to interact with both\nSwitchboard workers and clients.\n\nAssuming that the Switchboard application is running, the following\nexample opens a connection to the server over the worker interface,\nand sends a batch request with a :code:`connect` command (see the\n`interfaces guide`_ for command documentation).\n\n.. code:: python\n\n worker = switchboard.Client(\"ws://192.168.50.2:8080/workers\")\n worker.connect()\n worker.send_cmds((\"connect\", CONN_SPEC))\n worker.run_forever()\n\nTo handle command responses, :code:`send_cmds` returns a promise_ that\nis fulfilled by the tuple :code:`(cmds, resps)` when the command's\nresponses arrive, where :code:`cmds` is the list of commands given to\n:code:`send_cmds`, and :code:`resps` is the list of responses returned\nby Switchboard.\n\n.. code:: python\n\n def handle_get_mailboxes((cmds, resps)):\n\tprint \"For cmds\", cmds, \", received resps:\", resps\n\n worker.send_cmds((\"getMailboxes\", {}).then(handle_get_mailboxes)\n\n\nTo add commands on connect, and/or handling of unsolicited messages\nsubclass the base :code:`switchboard.Client` -- an unsolicited message\nis not sent in response to a command, but when the server has new\ninformation, such as a new emails arriving\n\n.. code:: python\n\n class TheWorker(switchboard.Client):\n\tdef opened(self):\n\t print \"Connected to Switchboard, issuing watchAll cmd.\"\n\t worker.send_cmds((\"watchAll\", {}))\n\n\tdef received_unsolicited(resps):\n\t print \"Received unsolicited resps from server:\", resps\n\t for resp in resps:\n\t\tif resp[0] == 'newMessage':\n\t\t print \"New message:\", resp[1]\n\n\n worker = TheWorker(\"ws://127.0.0.1:8080/workers\")\n worker.connect()\n worker.run_forever()\n\n.. _interfaces guide: http://thusfresh.github.io/switchboard/guide/interfaces\n.. _promise: http://promises-aplus.github.io/promises-spec\n\nExamples\n========\n\nAll examples are located under :code:`/examples`. Each example uses\ncommand line arguments which you can investigate via:\n\n.. code:: shell\n\n ./examples/example.py --help\n\n\nlistener.py\n-----------\n\nThis worker provides a simple example of bidirectional communication\nusing the Switchboard worker interface. It listens for Switchboard\nto notify it of new emails, then fetches the raw email and parses\nit using the Python :code:`email` module:\n\n.. code:: shell\n\n ./examples/listener.py\n\n\napnsworker.py\n-------------\n\nThis worker sends new email `Apple Push Notifications`_ to an iOS\nclient given an APNS certificate, key, and pushtoken.\n\nNote: it *does not* map from account to push token when sending push\nnotifications -- it only sends the push notifications using the\nprovided push token:\n\n.. code:: shell\n\n ./examples/apnsworker.py --cert \"path/to/cert.pem\" --key \"path/to/key.pem\" --pushtoken \"target users hex pushtoken\"\n\n.. _Apple Push Notifications: https://developer.apple.com/notifications/\n\n\ntwilioworker.py\n---------------\n\nThis worker is similar to :code:`apnsworker.py`, except instead of sending\nAPNs when a new email arrives, it sends a text message via\nTwilio_:\n\n.. code:: shell\n\n ./examples/twilioworker.py --sid \"twilio sid\" --token \"twilio token\" --to \"to phone #\" --from \"from phone #\"\n\n.. _Twilio: https://twilio.com", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/jtmoulia/switchboard-python/tarball/0.1.0", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jtmoulia/switchboard-python", "keywords": "email,worker,websocket", "license": "LICENSE.txt", "maintainer": null, "maintainer_email": null, "name": "switchboard-python", "package_url": "https://pypi.org/project/switchboard-python/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/switchboard-python/", "project_urls": { "Download": "https://github.com/jtmoulia/switchboard-python/tarball/0.1.0", "Homepage": "https://github.com/jtmoulia/switchboard-python" }, "release_url": "https://pypi.org/project/switchboard-python/0.1.3/", "requires_dist": null, "requires_python": null, "summary": "Python switchboard utilites", "version": "0.1.3" }, "last_serial": 1237646, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "f9a16d0c0cdf92ed4d357dff9d845678", "sha256": "c5ab6ca5c0cb3b0b86ff1a2c19f135b93b8615f031e95f922262e8915fc1cf14" }, "downloads": -1, "filename": "switchboard-python-0.1.0.tar.gz", "has_sig": false, "md5_digest": "f9a16d0c0cdf92ed4d357dff9d845678", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7826, "upload_time": "2014-06-24T07:00:27", "url": "https://files.pythonhosted.org/packages/c9/e0/8633120d930a9647fecb8fa295d32ea8dcc270b5d04ae7fb1f8a855da2f5/switchboard-python-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "da8bdd8444a615aff8e3f5ad40423ee9", "sha256": "ed18c033c5b8ed48dafeeb164697e3d4492676923de27833dd53d552bee4ddfd" }, "downloads": -1, "filename": "switchboard-python-0.1.1.tar.gz", "has_sig": false, "md5_digest": "da8bdd8444a615aff8e3f5ad40423ee9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7839, "upload_time": "2014-06-24T07:04:50", "url": "https://files.pythonhosted.org/packages/da/2f/0fa520cde50449d063922250f9b78011ec47fadba385c046fe213e645684/switchboard-python-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "7c1d8b8ac49e09e790f741dad45fba84", "sha256": "be1b05e4d683045a6b5f11d207126a4b79810fda858f924a7f0cdb8473e71067" }, "downloads": -1, "filename": "switchboard-python-0.1.2.tar.gz", "has_sig": false, "md5_digest": "7c1d8b8ac49e09e790f741dad45fba84", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7086, "upload_time": "2014-06-24T07:06:03", "url": "https://files.pythonhosted.org/packages/6e/43/b7244a4a3b6303870be06fe9acbd0f5d27ece6dc02748bb2943ba3609646/switchboard-python-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "built for Darwin-13.3.0", "digests": { "md5": "31c3e8f887d975f07e4b2841e6e08b90", "sha256": "edf142da7c822afce16a30f61ca83b84acf1ffa6c2e316f8efbe22adfcb42e94" }, "downloads": -1, "filename": "switchboard-python-0.1.3.macosx-10.9-x86_64.tar.gz", "has_sig": false, "md5_digest": "31c3e8f887d975f07e4b2841e6e08b90", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 11015, "upload_time": "2014-09-25T11:37:06", "url": "https://files.pythonhosted.org/packages/0d/2c/4237ab08d9a0b73a540ce9514f591e0efad5e4f6e30356a8ce646ce7073d/switchboard-python-0.1.3.macosx-10.9-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "c5b2cfaba679447c10ac9e63390aa384", "sha256": "972aa6942e53037747ed892712d06ef8724aaaa3cd28795d4774b58f6ced8cc0" }, "downloads": -1, "filename": "switchboard-python-0.1.3.tar.gz", "has_sig": false, "md5_digest": "c5b2cfaba679447c10ac9e63390aa384", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7131, "upload_time": "2014-09-25T11:37:18", "url": "https://files.pythonhosted.org/packages/e2/45/adf7063db56dfe6ecb3c1b2de2bbe4dcdbfb836ce620068eac3873aab1e3/switchboard-python-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "built for Darwin-13.3.0", "digests": { "md5": "31c3e8f887d975f07e4b2841e6e08b90", "sha256": "edf142da7c822afce16a30f61ca83b84acf1ffa6c2e316f8efbe22adfcb42e94" }, "downloads": -1, "filename": "switchboard-python-0.1.3.macosx-10.9-x86_64.tar.gz", "has_sig": false, "md5_digest": "31c3e8f887d975f07e4b2841e6e08b90", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 11015, "upload_time": "2014-09-25T11:37:06", "url": "https://files.pythonhosted.org/packages/0d/2c/4237ab08d9a0b73a540ce9514f591e0efad5e4f6e30356a8ce646ce7073d/switchboard-python-0.1.3.macosx-10.9-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "c5b2cfaba679447c10ac9e63390aa384", "sha256": "972aa6942e53037747ed892712d06ef8724aaaa3cd28795d4774b58f6ced8cc0" }, "downloads": -1, "filename": "switchboard-python-0.1.3.tar.gz", "has_sig": false, "md5_digest": "c5b2cfaba679447c10ac9e63390aa384", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7131, "upload_time": "2014-09-25T11:37:18", "url": "https://files.pythonhosted.org/packages/e2/45/adf7063db56dfe6ecb3c1b2de2bbe4dcdbfb836ce620068eac3873aab1e3/switchboard-python-0.1.3.tar.gz" } ] }