{ "info": { "author": "Christo Crampton", "author_email": "info@38.co.za", "bugtrack_url": null, "classifiers": [ "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# DJ StreamIO\n\nFramework for making it easy to post stream updates to (stream.io)[https://getstream.io]\n\n## Installation\n\n[![PyPI version](https://badge.fury.io/py/dj-streamio.svg)](https://badge.fury.io/py/dj-streamio)\n\n```\npip install dj-streamio\n```\n\n## Configuration\n\n### 1. Add `streamio` to `INSTALLED_APPS`\n\n### 2. Configure your models for tracking:\n\ne.g.:\n\n```python\nfrom streamio.mixins import StreamModelMixin\n\nclass Todo(models.Model, StreamModelMixin):\n\n collection = 'todos'\n feed_name = 'todo'\n feed_actor_field = 'owner_id'\n feed_once_off_actions = [\"create\"]\n feed_related_mapping = [\n # feed_slug, model_field\n ('user', 'owner_id'),\n ('todo', 'id'),\n ]\n # a list of object_id prefixes to look for in the `object_ids` field\n # e.g.: todo.object_ids = [\"foo:1\", \"bar:2\"]\n feed_object_ids_mapping = [\"foo\", \"bar\"]\n enrichment_serializer = 'example_app.models.TodoSerializer'\n\n```\n\n**Notes:**\n\n1. We add `StreamModelMixin` to our model\n2. Add the various meta fields\n3. Profit\n\n#### Track actions:\n\n```python\ntodo = Todo.objects.first()\ntodo.track_action('create')\ntodo.track_action('start')\ntodo.track_action('complete')\n```\n\n#### Add reaction:\n\nYou can add a reaction (e.g.: like, comment, upvote etc) to an activity\n\n**Example**\n\n```python\ntodo.add_reaction(\n activity_kind, # e.g.: like, comment, status\n activity_id,\n data,\n by=user_id,\n target_feeds=[\"notification:thierry\"]\n)\n```\n\n**notes:**\n\n* `data` is the reaction data. e.g.: `{\"text\": \"@thierry great post!\"}`\n* `by` (optional) will default to the models `actor_id` if none is provided.\n* `target_feeds` (optional) will default to the models `feed_related_mapping`.\n\n**Stream docs on Reactions:** https://getstream.io/docs/python/#reactions_introduction\n\n#### Add notifications:\n\n```python\ntodo = Todo.objects.first()\n\n# note: you'll need to setup a webhook to actually handle forwarding!\n# https://getstream.io/docs/#realtime-webhooks\n\n# a combination of ways to propagate this notification (all are optional)\nforward = {\n \"sms\": ['+27...', '+27...'],\n \"inapp\": ['user:1', 'user:2'], # inapp notification channels\n \"email: ['jane@soap.com', 'joe@soap.com']\n}\n\ntodo.add_notification(\n verb=\"..\",\n notify=[user1.id, user2.id],\n message='hello!',\n forward = forward\n)\n```\n\n### Get Feed\n\n```python\ntodo = Todo.objects.first()\n# get feed with all the defaults\ntodo.get_feed()\n\n# you can set any extra args with kwargs:\n# available parameters: https://getstream.io/docs/python/#retrieve\ntodo.get_feed({\"limit\": 5, \"offset\": 5, \"enrich\": False})\n```\n\n### Feed mixin\n\n> `dj-streamio` provides a mixin that can be used to expose a `/stream/` endpoint on a DjangoRestFramework `ModelViewSet`. This endpoint proxiess the group feed for the underlying model. It also provides an analytics endpoint which gives a breakdown of the last 100 activities at `/streamactivity/`\n\n**Example:**\n\n```python\nfrom streamio.viewsets import StreamViewSetMixin\n\n# for older versions of DRF (prior to the @action update) use this mixin\n# from streamio.viewsets_legacy import StreamViewSetMixin\n\n...\n\n# then simply mix it into your ViewSet:\n\nclass TodoViewSet(StreamViewSetMixin, viewsets.ModelViewSet):\n queryset = Todo.objects.all()\n serializer_class = TodoSerializer\n\n# /todos/:pk/stream/\n# /todos/:pk/streamactivity/\n```\n\n## Low level usage\n\n```python\nfrom streamio.streamio import get_client\nstream = get_client() # returns a standard logged-in stream.io client\n...\n```\n**Note:**\n\n* See also: `StreamObject` and `StreamUser`\n\n### TODOS:\n\n* Provide alternative backends (later)", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://gitlab.com/schoolorchestration/libs/dj-streamio", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "dj-streamio", "package_url": "https://pypi.org/project/dj-streamio/", "platform": "", "project_url": "https://pypi.org/project/dj-streamio/", "project_urls": { "Homepage": "https://gitlab.com/schoolorchestration/libs/dj-streamio" }, "release_url": "https://pypi.org/project/dj-streamio/0.2.7/", "requires_dist": null, "requires_python": "", "summary": "", "version": "0.2.7" }, "last_serial": 5569703, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "9408563a480788d8d67a23b612210017", "sha256": "8f34c5e2d0a0377c9849a86a97e3003c88a5a63b83bf973a9cbcbb05c940eca4" }, "downloads": -1, "filename": "dj-streamio-0.0.1.tar.gz", "has_sig": false, "md5_digest": "9408563a480788d8d67a23b612210017", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3396, "upload_time": "2019-06-04T21:47:07", "url": "https://files.pythonhosted.org/packages/8c/c7/e4c112e9e3bf6348e5e0265d97ef24ed7c44d9f78b5f295e158abb5526fb/dj-streamio-0.0.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "702924d8d33e10106df6855f4d44b600", "sha256": "ba18a64fdb13e4cab7dfd05d8b0cbb35b639c33303b6e35a1f52b9a767c6c6f5" }, "downloads": -1, "filename": "dj-streamio-0.2.0.tar.gz", "has_sig": false, "md5_digest": "702924d8d33e10106df6855f4d44b600", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4949, "upload_time": "2019-07-05T16:23:12", "url": "https://files.pythonhosted.org/packages/4e/6c/27fe44910943cc600257f1ccee3e9aafaf103c120a53975c659d0618081e/dj-streamio-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "c114ddf17aa63b5a502baf5433076b05", "sha256": "3c2f36e3e5b70f1d85ae397d82bbfda1a9590bfa76e687fe8c3bb601122f4a8f" }, "downloads": -1, "filename": "dj-streamio-0.2.1.tar.gz", "has_sig": false, "md5_digest": "c114ddf17aa63b5a502baf5433076b05", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5323, "upload_time": "2019-07-05T18:35:13", "url": "https://files.pythonhosted.org/packages/1f/b0/896a89eea3063d9f120966cdf26060b7107969c0459756072800617e6855/dj-streamio-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "69de933b3415dfba6e04f97ba09d57db", "sha256": "857790ed57f61297f8f2e3dd4bac1f17d387438c4a918b332e77a5a03a2efbf2" }, "downloads": -1, "filename": "dj-streamio-0.2.2.tar.gz", "has_sig": false, "md5_digest": "69de933b3415dfba6e04f97ba09d57db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5763, "upload_time": "2019-07-06T00:43:47", "url": "https://files.pythonhosted.org/packages/5c/2c/2eef1cdafb83daad657ab749cc9379882de7b296284ba5773f2263eaac30/dj-streamio-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "ddd2d820ceaa781d79ffe2c7e7645396", "sha256": "1890d959aebcd5b2831787bc8518f24496b7367e73cace7e4a7909e3cf35e101" }, "downloads": -1, "filename": "dj-streamio-0.2.3.tar.gz", "has_sig": false, "md5_digest": "ddd2d820ceaa781d79ffe2c7e7645396", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5770, "upload_time": "2019-07-06T01:55:49", "url": "https://files.pythonhosted.org/packages/33/3b/8f0eb9f4e6e4e0dae378f454b5d7ad2be91cf8a089b8aa2b7207d5eb6bb3/dj-streamio-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "8e03e5ac3923bb4fd33c36ef82fee8ab", "sha256": "d0f10096eaad55ecfe55c5a0c8cca06cdc28d31f6ab57b62f7f86ab38e96912e" }, "downloads": -1, "filename": "dj-streamio-0.2.4.tar.gz", "has_sig": false, "md5_digest": "8e03e5ac3923bb4fd33c36ef82fee8ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5798, "upload_time": "2019-07-19T20:21:40", "url": "https://files.pythonhosted.org/packages/20/1c/275e3695a9e8b0bc1f78a958b5310454ecb9414dfa614266ca3e0147e29a/dj-streamio-0.2.4.tar.gz" } ], "0.2.5": [ { "comment_text": "", "digests": { "md5": "8b6b9900bb36bd5d188f793f9cc5c325", "sha256": "b4e452b7e7fe018139974909ef3722b4d95d5c7c11afa7b56179c021cd909390" }, "downloads": -1, "filename": "dj-streamio-0.2.5.tar.gz", "has_sig": false, "md5_digest": "8b6b9900bb36bd5d188f793f9cc5c325", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6595, "upload_time": "2019-07-22T17:40:37", "url": "https://files.pythonhosted.org/packages/ac/1e/6b15d73ef145fa512c19f691158818474f71b9172f51a9608f0be05135b9/dj-streamio-0.2.5.tar.gz" } ], "0.2.6": [ { "comment_text": "", "digests": { "md5": "ed734c2c09c1004dcaaddf2d7e737598", "sha256": "b08a30b84cd51762a2488b152ced4efb042a69e2fa18438b6843c198fcc15011" }, "downloads": -1, "filename": "dj-streamio-0.2.6.tar.gz", "has_sig": false, "md5_digest": "ed734c2c09c1004dcaaddf2d7e737598", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6631, "upload_time": "2019-07-22T20:48:46", "url": "https://files.pythonhosted.org/packages/0e/4b/1e6f17b83fd5686bf330ae33b8218c10e8f51489433bf85c0f246c3a1bc7/dj-streamio-0.2.6.tar.gz" } ], "0.2.7": [ { "comment_text": "", "digests": { "md5": "f65e9a6cea7c3e5175d01a4ed8e2c3dd", "sha256": "ca5bc21069ab66aa0317e8bc511b7c74610f608641223e381317b91d47ff7e3d" }, "downloads": -1, "filename": "dj-streamio-0.2.7.tar.gz", "has_sig": false, "md5_digest": "f65e9a6cea7c3e5175d01a4ed8e2c3dd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6734, "upload_time": "2019-07-22T23:58:36", "url": "https://files.pythonhosted.org/packages/b1/07/910b7a9333b57f45433d35fdccb5c44b537c9537205258fae1684d4c8d38/dj-streamio-0.2.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f65e9a6cea7c3e5175d01a4ed8e2c3dd", "sha256": "ca5bc21069ab66aa0317e8bc511b7c74610f608641223e381317b91d47ff7e3d" }, "downloads": -1, "filename": "dj-streamio-0.2.7.tar.gz", "has_sig": false, "md5_digest": "f65e9a6cea7c3e5175d01a4ed8e2c3dd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6734, "upload_time": "2019-07-22T23:58:36", "url": "https://files.pythonhosted.org/packages/b1/07/910b7a9333b57f45433d35fdccb5c44b537c9537205258fae1684d4c8d38/dj-streamio-0.2.7.tar.gz" } ] }