{ "info": { "author": "Sergey Keller", "author_email": "izdieu@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "\n\n# Django Slack OAuth [![Build Status](https://travis-ci.org/izdi/django-slack-oauth.svg?branch=master)](https://travis-ci.org/izdi/django-slack-oauth)\n\nA lightweight module for integrating your Django application with Slack.\n\n## Requirements\n\n- Django >= 1.8\n\nTo use Slack OAuth in your Django app, you'll need your `SLACK_CLIENT_ID` and `SLACK_CLIENT_SECRET` which can be found when you [Create a New Slack Application](https://api.slack.com/applications).\n\n\n## Instructions\n\n1. Install using pip:\n\n ```\n $ pip install django-slack-oauth\n ```\n\n2. Add `django_slack_oauth` to `INSTALLED_APPS` in `settings.py`:\n\n ```python\n INSTALLED_APPS = (\n ...\n 'django_slack_oauth',\n )\n ```\n\n3. Run initial migrations:\n\n ```\n $ python manage.py migrate\n ```\n\n4. Add Slack OAuth base url to your project's `urls.py`:\n\n ```python\n urlpatterns = [\n ...\n url(r'^slack/', include('django_slack_oauth.urls')),\n ...\n ]\n ```\n\n5. Specify your Slack credentials and OAuth Scope in `settings.py`:\n\n ```python\n SLACK_CLIENT_ID = os.environ.get('SLACK_CLIENT_ID')\n SLACK_CLIENT_SECRET = os.environ.get('SLACK_CLIENT_SECRET')\n SLACK_SCOPE = 'admin,bot'\n ```\n If you aren't sure what your scope should be, read more about [Slack OAuth Scopes](https://api.slack.com/docs/oauth-scopes).\n\n## Example\n\nAdd a link to Slack OAuth in one of your templates:\n\n```\nGet slacked\n```\n\nAfter clicking it, you will be redirected to Slack for the OAuth process. If successful, you will be redirected to a view showing a success message. You can change this view by setting `SLACK_SUCCESS_REDIRECT_URL` in `settings.py`.\n\nYou can then view the successful request and API data in the Admin under Slack OAuth Requests.\n\n\n## Advanced Usage\n\n### Pipelines\n\nPipelines allow you to create actions after a successful OAuth authentication. Some use cases may be:\n\n- Register an account for the user\n- Capture returned API data from Slack after authentication (Default Behaviour)\n- Send Slack messages to the user's Slack team after authentication\n\nThey are simply a list of functions, which get called in order. They must accept and return two parameters: `request` and `api_data`, containing the initial request and returned API data respectively.\n\nPipelines are defined as a list of callables in `settings.py`:\n\n```python\nSLACK_PIPELINES = [\n 'path.to.function1',\n 'path.to.function2',\n ...\n]\n```\n\n\n- **Example 1:** Show returned data from the OAuth request\n\n *settings.py*\n\n ```python\n ...\n SLACK_PIPELINES = [\n 'my_app.pipelines.debug_oauth_request',\n ]\n ```\n\n *my_app/pipelines.py*\n\n ```python\n def debug_oauth_request(request, api_data):\n print(api_data)\n return request, api_data\n ```\n\n- **Example 2:** Register User and send an email\n\n *settings.py*\n\n ```python\n ...\n SLACK_PIPELINES = [\n 'my_app.pipelines.register_user',\n 'my_app.pipelines.send_email',\n ]\n ```\n\n *my_app/pipelines.py*\n\n ```python\n from django.contrib.auth.models import User\n\n from django_slack_oauth.models import SlackUser\n\n\n def register_user(request, api_data):\n if api_data['ok']:\n user, created = User.objects.get_or_create(\n username=api_data['team_id']+':'+api_data['user_id']\n )\n\n if user.is_active:\n slacker, _ = SlackUser.objects.get_or_create(slacker=user)\n slacker.access_token = api_data.pop('access_token')\n slacker.extras = api_data\n slacker.save()\n\n if created:\n request.created_user = user\n\n return request, api_data\n\n\n def notify(request, api_data):\n if hasattr(request, 'created_user'):\n notify_admins(\"New user with id {} has been created.\".format(request.created_user))\n notify_user(request.created_user)\n\n return request, api_data\n ```\n\n_Thanks to_ [Daniel van Flymen](https://github.com/dvf)\n\n### Slack Endpoints\n\nThe following parameters may be overriden, in the (rare) case that Slack changes their endpoints:\n\n```python\nSLACK_AUTHORIZATION_URL = 'https://slack.com/oauth/authorize'\nSLACK_OAUTH_ACCESS_URL = 'https://slack.com/api/oauth.access'\n```\n\n### Forgery Attacks\n\nTo avoid forgery attacks we pass the `state` parameter in the initial authorization request. This state is stored in the session, which requires the [session middleware to be enabled](https://docs.djangoproject.com/en/2.1/topics/http/sessions/#enabling-sessions) (on by default).", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/izdi/django-slack-oauth/tarball/1.5.0", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/izdi/django-slack-oauth", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "django-slack-oauth", "package_url": "https://pypi.org/project/django-slack-oauth/", "platform": "", "project_url": "https://pypi.org/project/django-slack-oauth/", "project_urls": { "Download": "https://github.com/izdi/django-slack-oauth/tarball/1.5.0", "Homepage": "https://github.com/izdi/django-slack-oauth" }, "release_url": "https://pypi.org/project/django-slack-oauth/1.5.0/", "requires_dist": null, "requires_python": "", "summary": "Handles OAuth and stores slack token", "version": "1.5.0" }, "last_serial": 4574914, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "561ba6c3e8c2ec908909f27a4b19273e", "sha256": "78b46f3ea6321b920113a8d65b8ebf098b7d05be19cf41dca6283147a4dbd9c5" }, "downloads": -1, "filename": "django-slack-oauth-0.1.tar.gz", "has_sig": false, "md5_digest": "561ba6c3e8c2ec908909f27a4b19273e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3708, "upload_time": "2015-03-25T09:06:28", "url": "https://files.pythonhosted.org/packages/e1/f5/d2b5f72cc1e9e04b597186fa9d0b1ee0c15001eebaec1355f26ba29675f5/django-slack-oauth-0.1.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "d40b0a863fcd031423b42e9742109b53", "sha256": "935a4db6937c5ba9f316736091dd4090d278bb502623ac59ae79e5df7dd0760b" }, "downloads": -1, "filename": "django-slack-oauth-0.3.tar.gz", "has_sig": false, "md5_digest": "d40b0a863fcd031423b42e9742109b53", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5060, "upload_time": "2015-09-06T12:57:03", "url": "https://files.pythonhosted.org/packages/8e/80/4543361eb1d6b67297343dd4ef600df1ae3624b3b49be4346e6275e3a3ab/django-slack-oauth-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "c883520145fc94e96908dc040f5dfcaa", "sha256": "695c1aa7507a5d2c61cd87fd6df6f16895c9361acfca00557d5fd5e8f11ff320" }, "downloads": -1, "filename": "django-slack-oauth-0.4.macosx-10.10-x86_64.tar.gz", "has_sig": false, "md5_digest": "c883520145fc94e96908dc040f5dfcaa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9729, "upload_time": "2015-10-10T10:52:51", "url": "https://files.pythonhosted.org/packages/d6/46/7f9394965c42149c1b80df43ffc7a1732a6ed7f19f6a9b0183c56e72b09f/django-slack-oauth-0.4.macosx-10.10-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "d3a5caa3361fd389bf2a0f6f27c4179e", "sha256": "d164f677a80f60b7ce64c09ce897cedfa25bc5519780ede3b8b00594d052a0f7" }, "downloads": -1, "filename": "django-slack-oauth-0.4.tar.gz", "has_sig": false, "md5_digest": "d3a5caa3361fd389bf2a0f6f27c4179e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5607, "upload_time": "2015-10-02T22:04:17", "url": "https://files.pythonhosted.org/packages/55/64/bab3eab8cdd0ddc9a796bad84c438936e802be9f86cd6416349b64ed7594/django-slack-oauth-0.4.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "58a89e80c470fc3e2ba50b3e85e75f02", "sha256": "253301c1da0236d1ebc8e03d99842e8175103530eedfee9c0966e7bac133da71" }, "downloads": -1, "filename": "django-slack-oauth-0.4.1.tar.gz", "has_sig": false, "md5_digest": "58a89e80c470fc3e2ba50b3e85e75f02", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5960, "upload_time": "2015-10-10T10:54:26", "url": "https://files.pythonhosted.org/packages/51/1c/6ef1a839c6dbbabcffcc0af8be9928b85772d6fca950910ced47d11c2b6e/django-slack-oauth-0.4.1.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "dcf9d58e966eaa9fdded970b0147561d", "sha256": "7413abd2371ec81b350b122356d825d365a780e2b5fa299d78e446dd8a07f10d" }, "downloads": -1, "filename": "django-slack-oauth-0.5.tar.gz", "has_sig": false, "md5_digest": "dcf9d58e966eaa9fdded970b0147561d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4867, "upload_time": "2016-02-06T19:03:35", "url": "https://files.pythonhosted.org/packages/7a/b0/9465979f52584d66c637dc073563abbbad81bb953723213aa83a6e0944da/django-slack-oauth-0.5.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "28132856b8284062da3a46d66b718a02", "sha256": "0e8315ca16bf614f0200a2797a0c8cf932dbeddd6573e0dbd79868321250629a" }, "downloads": -1, "filename": "django_slack_oauth-0.6-py2-none-any.whl", "has_sig": false, "md5_digest": "28132856b8284062da3a46d66b718a02", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 11284, "upload_time": "2016-09-30T22:22:15", "url": "https://files.pythonhosted.org/packages/14/42/a043f613857f2f75fd3b396e7ba8f141556bb310922da8e5212f4d5dde67/django_slack_oauth-0.6-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8c0506b63ed749a9815ada1410e4a5e2", "sha256": "06107bbc77912e16dee7b1ddd7e36a72b33f2f62129fc880b06f8437bea5948b" }, "downloads": -1, "filename": "django-slack-oauth-0.6.tar.gz", "has_sig": false, "md5_digest": "8c0506b63ed749a9815ada1410e4a5e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5024, "upload_time": "2016-09-30T22:22:06", "url": "https://files.pythonhosted.org/packages/8d/9b/ef279e2bf238c6446cf340e337b4cd6f8bf046add6865f8e27733ca4f6f9/django-slack-oauth-0.6.tar.gz" } ], "0.6.1": [ { "comment_text": "", "digests": { "md5": "412cccd42d0afb1950636494fdec0d0a", "sha256": "806d40f3064c439e03989ab303beed32ed05a9252224671434df1da9765bff9f" }, "downloads": -1, "filename": "django_slack_oauth-0.6.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "412cccd42d0afb1950636494fdec0d0a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11207, "upload_time": "2016-10-02T08:28:47", "url": "https://files.pythonhosted.org/packages/04/04/f924dc64384f922fba2065a90a681b64dc1d45befb75d3109088e714af67/django_slack_oauth-0.6.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1d7763497f947235fae5fd95806cacb9", "sha256": "fa6c4c95a0ddf3fd55850b246e0af4baa1fba94e3c1677b7528842a23f4c7ccf" }, "downloads": -1, "filename": "django-slack-oauth-0.6.1.tar.gz", "has_sig": false, "md5_digest": "1d7763497f947235fae5fd95806cacb9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4989, "upload_time": "2016-10-02T08:28:45", "url": "https://files.pythonhosted.org/packages/5f/58/a7629c3488815c23f7e51e21a2252f952c2f225498b163596b899554d61f/django-slack-oauth-0.6.1.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "604247dac9353f17f0dcc0d75342522a", "sha256": "9aac14b977c3b68f9e29bd6d4dbd2d22ff90f9114f982888edd117adf7fa5d29" }, "downloads": -1, "filename": "django_slack_oauth-1.0.0-py2-none-any.whl", "has_sig": true, "md5_digest": "604247dac9353f17f0dcc0d75342522a", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 15610, "upload_time": "2017-01-10T09:45:58", "url": "https://files.pythonhosted.org/packages/1a/ff/5bf290c7904bf6259ff3f080d82f3b1a4d69500fc25240c1f82ce3e1365c/django_slack_oauth-1.0.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6b8f25133ee0afab143e5029ae7a8996", "sha256": "ff62a7cd0377a17720d9983be1d5079465a544876970f7798cce3985ca8a96e7" }, "downloads": -1, "filename": "django-slack-oauth-1.0.0.tar.gz", "has_sig": true, "md5_digest": "6b8f25133ee0afab143e5029ae7a8996", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7148, "upload_time": "2017-01-10T09:45:52", "url": "https://files.pythonhosted.org/packages/8b/c3/6b5a979902cb0f466924e2e5b5839621867e7b326703e3b10e53fb2cc482/django-slack-oauth-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "230b529bd6bbd485ef88af84ce538805", "sha256": "662d234b80c77db700484a44ff24a02f580e1b299fb8ac44b677e502830025af" }, "downloads": -1, "filename": "django_slack_oauth-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "230b529bd6bbd485ef88af84ce538805", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 12724, "upload_time": "2017-06-21T07:35:27", "url": "https://files.pythonhosted.org/packages/06/65/8fbced857f02d7e52d0cb82bc777b3f42d938740165785c9eb6bd1d12495/django_slack_oauth-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "27984d418876a101059a3a8e92c1f41e", "sha256": "b168d9b49e05254bf9312cb01f295c9ef1e3ae97ac2585f60c4272ff77e4a947" }, "downloads": -1, "filename": "django-slack-oauth-1.1.0.tar.gz", "has_sig": false, "md5_digest": "27984d418876a101059a3a8e92c1f41e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7080, "upload_time": "2017-06-21T07:35:24", "url": "https://files.pythonhosted.org/packages/a2/0b/422633bc3383c0c080eebbcf6e4d585098c25fb9b21736fd8f5c21c767b8/django-slack-oauth-1.1.0.tar.gz" } ], "1.3.0": [ { "comment_text": "", "digests": { "md5": "a997fb47ce3eb1e0df608bdb857bd546", "sha256": "f4ddc210da0eab1f8e9f80fc57c27f1b1747e56a7d5f5a13f1461924c50d2f59" }, "downloads": -1, "filename": "django-slack-oauth-1.3.0.tar.gz", "has_sig": false, "md5_digest": "a997fb47ce3eb1e0df608bdb857bd546", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7027, "upload_time": "2017-10-05T13:21:18", "url": "https://files.pythonhosted.org/packages/dd/d7/13691e2d10fa9c8bb4556cb6bb744a4e83fa56e96d04edfd46377ae9408d/django-slack-oauth-1.3.0.tar.gz" } ], "1.4.0": [ { "comment_text": "", "digests": { "md5": "506f1ac0230eb056d592071070d69995", "sha256": "73cd99ef00822a56588ae1909acebfcfb41d2a3317d04707b8b5c0fcda230003" }, "downloads": -1, "filename": "django-slack-oauth-1.4.0.tar.gz", "has_sig": false, "md5_digest": "506f1ac0230eb056d592071070d69995", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7119, "upload_time": "2017-12-24T14:39:17", "url": "https://files.pythonhosted.org/packages/ca/7d/adab3ce7f2bf6cba2d088a5c4bb250eb44d180975330105ddc99b2b4f43c/django-slack-oauth-1.4.0.tar.gz" } ], "1.4.2": [ { "comment_text": "", "digests": { "md5": "a44fd1bcc30125824148054124dd46e7", "sha256": "c29b5d8359d98d980af822a516cad02a2dc8a20a0250ad0d5bdb17470e619211" }, "downloads": -1, "filename": "django-slack-oauth-1.4.2.tar.gz", "has_sig": false, "md5_digest": "a44fd1bcc30125824148054124dd46e7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7113, "upload_time": "2017-12-24T14:41:50", "url": "https://files.pythonhosted.org/packages/2f/d9/9c8858751cd040ea5bab9dd7ef584292b0006bdec15d2a1a40b0ec6b2f21/django-slack-oauth-1.4.2.tar.gz" } ], "1.4.3": [ { "comment_text": "", "digests": { "md5": "4aeae038806372879eb18277a8be29c5", "sha256": "4602f7ff9e0d5a72efe7fc60565ccf75f1eb3672c93e80aeb5c6fc3a8b248100" }, "downloads": -1, "filename": "django-slack-oauth-1.4.3.tar.gz", "has_sig": false, "md5_digest": "4aeae038806372879eb18277a8be29c5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7173, "upload_time": "2017-12-24T18:06:40", "url": "https://files.pythonhosted.org/packages/78/57/5d12edc3e973410711181a05c99ccbddb5580b5025c22a19f63c7858f6ed/django-slack-oauth-1.4.3.tar.gz" } ], "1.5.0": [ { "comment_text": "", "digests": { "md5": "eb455f09113fccef44cac2937b2f62d8", "sha256": "267befae1ee36598219f81a1b38669c9792914514195252a5115e0a785fc7b74" }, "downloads": -1, "filename": "django_slack_oauth-1.5.0-py3-none-any.whl", "has_sig": false, "md5_digest": "eb455f09113fccef44cac2937b2f62d8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10289, "upload_time": "2018-12-08T10:20:10", "url": "https://files.pythonhosted.org/packages/e1/3b/6bb1fbb15584aa0f906a690fcc51d7f8c54fc0906ac454fb17d68aa80027/django_slack_oauth-1.5.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bb8457aafc8be4aa460a688bed6c8e20", "sha256": "6c58e82cbbb846601a9d002a1e3f7fe019e302580f96849918c8cdc809db1e85" }, "downloads": -1, "filename": "django-slack-oauth-1.5.0.tar.gz", "has_sig": false, "md5_digest": "bb8457aafc8be4aa460a688bed6c8e20", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8288, "upload_time": "2018-12-08T10:15:20", "url": "https://files.pythonhosted.org/packages/38/7b/08916932de5c84aa326183b64b6dba04bd326b6e552d379847d3e24768e7/django-slack-oauth-1.5.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "eb455f09113fccef44cac2937b2f62d8", "sha256": "267befae1ee36598219f81a1b38669c9792914514195252a5115e0a785fc7b74" }, "downloads": -1, "filename": "django_slack_oauth-1.5.0-py3-none-any.whl", "has_sig": false, "md5_digest": "eb455f09113fccef44cac2937b2f62d8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10289, "upload_time": "2018-12-08T10:20:10", "url": "https://files.pythonhosted.org/packages/e1/3b/6bb1fbb15584aa0f906a690fcc51d7f8c54fc0906ac454fb17d68aa80027/django_slack_oauth-1.5.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bb8457aafc8be4aa460a688bed6c8e20", "sha256": "6c58e82cbbb846601a9d002a1e3f7fe019e302580f96849918c8cdc809db1e85" }, "downloads": -1, "filename": "django-slack-oauth-1.5.0.tar.gz", "has_sig": false, "md5_digest": "bb8457aafc8be4aa460a688bed6c8e20", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8288, "upload_time": "2018-12-08T10:15:20", "url": "https://files.pythonhosted.org/packages/38/7b/08916932de5c84aa326183b64b6dba04bd326b6e552d379847d3e24768e7/django-slack-oauth-1.5.0.tar.gz" } ] }