{ "info": { "author": "Hugo Rodger-Brown", "author_email": "hugo@yunojuno.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "django-trello-webhooks\n======================\n\nDjango application for managing Trello webhooks.\n\n**\\*LOOKING FOR CONTRIBUTORS\\***\n\n**UPDATE 01-Dec-2014**\n\nThe application can now be deployed directly to Heroku using their Deploy\nbutton. In addition, the test app that is bundled into this repo has been\ndeployed and is live.\n\n* It is listening to a public `Trello board `_\n* Updates are posted to an open `HipChat room `_\n* You can log in to the `admin site `_\n using the username **public** and the password **trello**\n\nI am going to post further docs on the Trello board itself, so that will become\nthe primary source for updates: https://trello.com/b/TAAnwdP9/\n\nStatus\n------\n\n.. image:: https://travis-ci.org/yunojuno/django-trello-webhooks.svg?branch=master\n :target: https://travis-ci.org/yunojuno/django-trello-webhooks\n\nThe app is now working, and deployable to Heroku (see below). The main outstanding\nissue is writing some proper docs, but until / unless there is any genuine external\ninterest shown in this project I won't be spending any formal time on it, so\nplease don't expect much more.\n\nBackground\n----------\n\n`Trello webhooks `_\ncan only be managed programmatically via the API, which is clever, but also\na massive PITA. In addition, whilst creating a new webhook, Trello will\nimmediately call the registered callback URL with a HEAD request to verify\nthat it exists. This makes setting up webhooks fiddly and complex (esp. when\nexperimenting in a local development environment).\n\nThis project is a Django app that makes managing Trello webhook easy. Well,\neasier. It exposes Trello webhooks through the Django admin site as standard\nDjango models that can be created and deleted through a web UI. Incoming\nwebhook events are then exposed via Django signals that are raised, and\ncan be integrated into your application.\n\nHow does it work?\n-----------------\n\nEach webhook is modelled as a Django model (``Webhook``), and each callback\nreceived on the webhook is modelled as a ``CallbackEvent`` object that\ncontains the JSON payload (so it will maintain a complete history of all\ncallbacks).\n\nThe ``Webhook.save()`` method is used to register the webhook with the Trello\nAPI. The corresponding delete method is used to delete the webhook from Trello.\n\nThe app contains a single view function, ``api_callback``, which receives the\ncallback from Trello, and which also supports the synchronous activation of\nnew webhooks by Trello. (When you create a webhook via the Trello API, they\nwill immediately issue a HEAD request to the callback url supplied, so you\nneed to be able to handle this immediately.)\n\nThe important bit is then how you use the callback in your application.\nThis is done via Django signals. On each webhook callback, the app sends the\n``callback_received`` signal, passing in the data received via the callback.\n\nYour application then connects via this signal; below is taken from the\nincluded test_app, which sends the formatted event to HipChat:\n\n.. code:: python\n\n from django.conf import settings\n from django.dispatch import receiver\n\n from test_app.hipchat import send_to_hipchat\n\n from trello_webhooks.signals import callback_received\n\n @receiver(callback_received, dispatch_uid=\"callback_received\")\n def on_callback_received(sender, **kwargs):\n if settings.HIPCHAT_ENABLED:\n event = kwargs.pop('event')\n send_to_hipchat(event.render())\n\nIf you wanted to filter out only certain events for sending:\n\n.. code:: python\n\n def on_callback_received(sender, **kwargs):\n event = kwargs.pop('event')\n if event.event_type == 'commentCard':\n send_to_hipchat(event.render())\n\nThere is a Django management command which can be used to synchronise any\nexisting webhooks (in both directions), called ``sync_webhooks``. Run on\nits own, without any arguments, this will look up all the webhooks in\nthe local Django database, and sync then with Trello (creating them if\nthey don't already exist). It will also check Trello for any webhooks\nthat it has registered that do not exist locally, and create them.\n\nRendering the payload\n~~~~~~~~~~~~~~~~~~~~~\n\nOnce you've received a callback, along with its JSON payload, the next\nquestion is how to use it effectively. It is assumed (by me) that the\ncore use case for this project is to pipe the events elsewhere - in\nour case it's to HipChat, but other messaging services are available -\nyou've could even go old-school and email people stuff. Whatever you\ndecide to do, you will probably want to convert the JSON into some\nform of readable text output. In order to facilitate this each event\ntype (``createCard``, ``commentCard`` etc.) has an associated Django\ntemplate. The ``CallbackEvent`` model has a ``render`` method that\npasses the entire JSON payload into the relevant template as the\ntemplate context, so that you can extract the data.\n\nBelow is an example of the default ``commendCard.html`` template.\n\n.. code:: html\n\n {{action.memberCreator.fullName}} commented\n on the card \"{{action.data.card.name}}\"\n on the board \"{{action.data.board.name}}\":\n
{{action.data.text}}
\n\nThe default templates are designed to show what is possible - and it's\nrecommended that you override these in your application. You can do\nthis using Django template overriding - add your template to your\napplication in the same locaion (``/templates/trello_webhooks/.html``)\nand declare your app **above** the ``trello_webhooks`` app in the\n``INSTALLED_APPS`` setting, and your template will be used instead\nof the default.\n\nThe combination of overrideable templates and the ``callback_received`` signal\nmean that you should be able to integrate Trello fully into your app.\n\n**NB One word of caution**\n\nI have made no attempt to ensure that all events are covered - that's not\nreally the point. This app will store and forward any event that it\nreceives. In order to make it a little easier to manage unexpected events\nthere is a property of the ``CallbackEvent`` that is displayed in the\nadmin site list view - **Has Template**. If this is True, then this is\nan event for which we have a default template. If it's False, then\nthis is a new one on us - and you are encouraged to play around with\nadding a new template. Do please feed all new default templates back\nto the project.\n\nConfiguration\n-------------\n\nThere are three mandatory environment settings (following the\n`12-factor app `_ principle):\n\n* TRELLO_API_KEY\n* TRELLO_API_SECRET\n* CALLBACK_DOMAIN\n\nThe first two are the core Trello developer API keys - available from here:\nhttps://trello.com/1/appKey/generate\n\nThe CALLBACK_DOMAIN is included as you need to give a fully-qualified domain\nto the Trello API, and it's not always possible to infer what that might be\n- for instance when developing locally, you will need a tunnel from your\nmachine out onto the web using something like `ngrok `_.\n\nWhen managing hooks via the Trello API a third key is required, and this is\nuser specific - the admin site has a link next to the `auth_token` field on\nthe form for creating a new Webhook. This uses the Trello API client.js to\nperform the Oauth dance - and supplies the user token. All webhooks are\nregistered against a user token. That's how it works. (NB you can pass any\nuser tokens you have lying around to the ``sync_webhooks`` command and it\nwill check Trello for any existing webhooks registered with those tokens.)\n\nTests\n-----\n\nYou can run the tests yourself in the normal manner:\n\n.. code:: shell\n\n $ python manage.py test\n\nHowever, if you have ``tox`` installed (and I'd really recommend you do),\nthen you can simply run ``$ tox``, and this will also include coverage.\n\nCoverage isn't 100% (when is it), but if you do contribute please do include\ntests for any changes that you make.\n\nThe tests themselves use mock objects to replicate the two Trello API calls\n(``list_hooks`` and ``create_hook``), so no internet access is required. (The\nproject relies on `py-trello `_, and\nthat has coverage for the API calls.)\n\nSetup\n-----\n\nThe app is available on PyPI as ``django-trello-webhooks``, so install with ``pip``:\n\n.. code:: shell\n\n $ pip install django-trello-webhooks\n\nFurther Developments\n--------------------\n\n* Write some tests\n* Better integration with the Trello API\n* Handle user auth token expiry properly\n* Integration with Heroku's \"Deploy to Heroku\" button\n\nContributing\n------------\n\nUsual rules apply - fork, send pull request. Please try and adhere to the existing\ncoding style - it may not be your style, but it's the project's style, so PRs will\nbe rejected if they 'smell bad'. Specifically, given that this is an app that is\npushing data over the wire, and therefore hard to debug - lots of logging, and\nlots of comments. Seriously. Lots.\n\nLicence\n-------\n\nMIT (see LICENCE file)\n\nDependencies\n------------\n\nThe core Trello API integration is done using `py-trello `_\nfrom Richard Kolkovich (@sarumont), so thanks to him for that. He naturally\nrelies on `requests `_ from Kenneth Reitz,\nas well as `request-oauthlib `_, so\nthanks to anyone involved with either of those.\n\nAddenda\n-------\n\nThe webhook API works on the concept of a Trello model id. This refers to the object\nbeing watched - and could be a Board, a List, a Card etc. Getting these ids is a bit\nof a pain, to put it mildly, so I would strongly recommend using the excellent\n`Trello Explorer `_ app from Harald Wartig (@hwartig).\n\nI would also recommend the use of `ngrok `_ to expose your local\nDjango dev server during development.\n\nAs for development itself - use virtualenv, install dependencies from requirements.txt\nand set up environment variables. If that doesn't mean anything to you - I'm afraid\nyou have a lot to learn.\n\nDeploying to Heroku\n-------------------\n\nTODO: write proper docs\n\n.. image:: https://www.herokucdn.com/deploy/button.png\n :target: https://heroku.com/deploy?template=https://github.com/yunojuno/django-trello-webhooks\n\nThis repo contains a test app can be deployed directly to Heroku using their Deploy button.\nThis app will pipe Trello updates directly to a Hipchat room. You will need the following\ninformation in order to set up and configure the app:\n\n``TRELLO_API_KEY``, ``TRELLO_API_SECRET``, which you can get from here - https://trello.com/1/appKey/generate\n``HIPCHAT_API_TOKEN``, ``HIPCHAT_ROOM_ID``, which you can get from hipchat.com\n\nIn addition, you will need to set the ``CALLBACK_DOMAIN`` environment setting once the app\nhas been deployed. This should be set to the .herokuapp.com domain, that is\navailable once Heroku has deployed it.\n\nThe recommended hacking method (IMO) is to set up the Heroku app, and use that as your\nmain git remote - pull it down locally, change the relevant templates, push back to\nHeroku. If you're actually adding functionality, then please follow the **contributing**\ninstructions above.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/yunojuno/django-trello-webhooks", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "django-trello-webhooks", "package_url": "https://pypi.org/project/django-trello-webhooks/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-trello-webhooks/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/yunojuno/django-trello-webhooks" }, "release_url": "https://pypi.org/project/django-trello-webhooks/0.3/", "requires_dist": null, "requires_python": null, "summary": "Django Trello Webhooks - Trello callback integration for Django.", "version": "0.3" }, "last_serial": 2257923, "releases": { "0.1": [ { "comment_text": "built for Darwin-14.0.0", "digests": { "md5": "05850855bdb79986d3e7d257ba783c37", "sha256": "b89dd09c975f30ef01eab576e03baf716b7836917102f80a547f9347feab7486" }, "downloads": -1, "filename": "django-trello-webhooks-0.1.macosx-10.6-x86_64.tar.gz", "has_sig": false, "md5_digest": "05850855bdb79986d3e7d257ba783c37", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 17335, "upload_time": "2014-11-27T08:58:20", "url": "https://files.pythonhosted.org/packages/34/51/f084fc5593a70ad59ed18f0587d002a357c72abdfb7b09944fc4ef3bd8d8/django-trello-webhooks-0.1.macosx-10.6-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "bb5f4391113b68f0f9d6b217e44317e1", "sha256": "7ac1f15cddff84b2a071bd833e5ee0807d9901d3f35dbb1cda7c985be61cff93" }, "downloads": -1, "filename": "django_trello_webhooks-0.1-py2-none-any.whl", "has_sig": false, "md5_digest": "bb5f4391113b68f0f9d6b217e44317e1", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 18132, "upload_time": "2014-11-27T08:58:22", "url": "https://files.pythonhosted.org/packages/a3/cd/10ecfb553060be721b9e778f78a782eb6733ba93f9641f1f257284dc6a0d/django_trello_webhooks-0.1-py2-none-any.whl" } ], "0.2": [ { "comment_text": "built for Darwin-14.0.0", "digests": { "md5": "8ef3d80c36043f8599ade5b83e487062", "sha256": "105bf23e935af8ef68875e9d32ad30840d2ba7a8dd8a53d85cc09fc0111eaf30" }, "downloads": -1, "filename": "django-trello-webhooks-0.2.macosx-10.6-x86_64.tar.gz", "has_sig": false, "md5_digest": "8ef3d80c36043f8599ade5b83e487062", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 30217, "upload_time": "2014-11-29T17:47:41", "url": "https://files.pythonhosted.org/packages/8b/11/64c9a6a8e1fd7be22b56ed71782113e94c6dfdbf1568d23b76b49ac1770d/django-trello-webhooks-0.2.macosx-10.6-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "2892c33c3fb2e1e2ae6a254fabda9ecf", "sha256": "3f54f8c978c4dfc87757a172be72b548cc6e3692e366cbf2dd0570c7754efc64" }, "downloads": -1, "filename": "django_trello_webhooks-0.2-py2-none-any.whl", "has_sig": false, "md5_digest": "2892c33c3fb2e1e2ae6a254fabda9ecf", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 32423, "upload_time": "2014-11-29T17:47:44", "url": "https://files.pythonhosted.org/packages/e0/5b/fe97e77aac5b27be96d0192507a36a94e2d69abe71ac93b73b93f7e680d3/django_trello_webhooks-0.2-py2-none-any.whl" } ], "0.3": [ { "comment_text": "built for Darwin-14.0.0", "digests": { "md5": "b76a904a969e6d5092ee1ad426cd7710", "sha256": "741e85455287a3d9cceccbd9ed28f800b4e12275ab87a74172ac73562ce2fee0" }, "downloads": -1, "filename": "django-trello-webhooks-0.3.macosx-10.6-x86_64.tar.gz", "has_sig": false, "md5_digest": "b76a904a969e6d5092ee1ad426cd7710", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 34230, "upload_time": "2014-12-03T19:33:54", "url": "https://files.pythonhosted.org/packages/73/44/77e85aba352fae0fad113ce5c707733726def1b96e2b9391d2b430cb7ebc/django-trello-webhooks-0.3.macosx-10.6-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "cdc72f11c113fa1023c9b9a8549ab40e", "sha256": "76b6fb53d3bc7665420028c777200c8609a5a6e45f933e79bb2feeda0f2df3cb" }, "downloads": -1, "filename": "django_trello_webhooks-0.3-py2-none-any.whl", "has_sig": false, "md5_digest": "cdc72f11c113fa1023c9b9a8549ab40e", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 38534, "upload_time": "2014-12-03T19:34:01", "url": "https://files.pythonhosted.org/packages/2e/a1/7b695ca00e06f0372e6bf6360229271d2a6465d0777e5a8f83d7026f5b63/django_trello_webhooks-0.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "271949163c1d1dab1d12b11548f915c5", "sha256": "f29feaca7a7e8ec7123274e587a367f601afa8a7800d98affd20eca3d5aaee04" }, "downloads": -1, "filename": "django-trello-webhooks-0.3.tar.gz", "has_sig": false, "md5_digest": "271949163c1d1dab1d12b11548f915c5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21876, "upload_time": "2014-12-03T19:33:57", "url": "https://files.pythonhosted.org/packages/ac/4b/6d9c658e11ef96fe152455f49f83ddad413f73204162c065fff942c97779/django-trello-webhooks-0.3.tar.gz" } ] }, "urls": [ { "comment_text": "built for Darwin-14.0.0", "digests": { "md5": "b76a904a969e6d5092ee1ad426cd7710", "sha256": "741e85455287a3d9cceccbd9ed28f800b4e12275ab87a74172ac73562ce2fee0" }, "downloads": -1, "filename": "django-trello-webhooks-0.3.macosx-10.6-x86_64.tar.gz", "has_sig": false, "md5_digest": "b76a904a969e6d5092ee1ad426cd7710", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 34230, "upload_time": "2014-12-03T19:33:54", "url": "https://files.pythonhosted.org/packages/73/44/77e85aba352fae0fad113ce5c707733726def1b96e2b9391d2b430cb7ebc/django-trello-webhooks-0.3.macosx-10.6-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "cdc72f11c113fa1023c9b9a8549ab40e", "sha256": "76b6fb53d3bc7665420028c777200c8609a5a6e45f933e79bb2feeda0f2df3cb" }, "downloads": -1, "filename": "django_trello_webhooks-0.3-py2-none-any.whl", "has_sig": false, "md5_digest": "cdc72f11c113fa1023c9b9a8549ab40e", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 38534, "upload_time": "2014-12-03T19:34:01", "url": "https://files.pythonhosted.org/packages/2e/a1/7b695ca00e06f0372e6bf6360229271d2a6465d0777e5a8f83d7026f5b63/django_trello_webhooks-0.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "271949163c1d1dab1d12b11548f915c5", "sha256": "f29feaca7a7e8ec7123274e587a367f601afa8a7800d98affd20eca3d5aaee04" }, "downloads": -1, "filename": "django-trello-webhooks-0.3.tar.gz", "has_sig": false, "md5_digest": "271949163c1d1dab1d12b11548f915c5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21876, "upload_time": "2014-12-03T19:33:57", "url": "https://files.pythonhosted.org/packages/ac/4b/6d9c658e11ef96fe152455f49f83ddad413f73204162c065fff942c97779/django-trello-webhooks-0.3.tar.gz" } ] }