{ "info": { "author": "Mozilla Services", "author_email": "services-dev@mozilla.org", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4" ], "description": "Requests-Hawk\n#############\n\n.. image:: https://travis-ci.org/mozilla-services/requests-hawk.png\n :target: https://travis-ci.org/mozilla-services/requests-hawk\n\n\nThis project allows you to use `the python requests library\n`_ with `the hawk authentication\n`_ mechanism.\n\nHawk itself does not provide any mechanism for obtaining or transmitting the\nset of shared credentials required, but this project proposes a scheme we use\nacross mozilla services projects.\n\nGreat, how can I use it?\n========================\n\nFirst, you'll need to install it::\n\n .. code-block:: bash\n\n pip install requests-hawk\n\nThen, in your project, if you know the `id` and `key`, you can use::\n\n .. code-block:: python\n\n import requests\n from requests_hawk import HawkAuth\n\n hawk_auth = HawkAuth(id='my-hawk-id', key='my-hawk-secret-key')\n requests.post(\"https://example.com/url\", auth=hawk_auth)\n\nOr if you need to derive them from the hawk session token, instead use::\n\n .. code-block:: python\n\n import requests\n from requests_hawk import HawkAuth\n\n hawk_auth = HawkAuth(\n hawk_session=resp.headers['hawk-session-token'],\n server_url=self.server_url\n )\n requests.post(\"/url\", auth=hawk_auth)\n\nIn the second example, the ``server_url`` parameter to ``HawkAuth`` was used to\nprovide a default host name, to avoid having to repeat it for each request.\n\nIf you wish to override the default algorithm of ``sha256``, pass the desired\nalgorithm name using the optional ``algorithm`` parameter.\n\nNote: The ``credentials`` parameter has been removed. Instead pass ``id`` and\n``key`` separately (as above), or pass the existing dict as ``**credentials``.\n\nIntegration with httpie\n=======================\n\n`Httpie `_ is a tool which lets you do\nrequests to a distant server in a nice and easy way. Under the hood, ``httpie``\nuses the requests library. We've made it simple for you to plug hawk with it.\n\nIf you know the id and key, use it like that::\n\n .. code-block:: bash\n\n http POST localhost:5000/registration\\\n --auth-type=hawk --auth='id:key'\n\nOr, if you want to use the hawk session token, you can do as follows::\n\n .. code-block:: bash\n\n http POST localhost:5000/registration\\\n --auth-type=hawk --auth='c0d8cd2ec579a3599bef60f060412f01f5dc46f90465f42b5c47467481315f51:'\n\nTake care, don't forget to add the extra ``:`` at the end of the hawk session\ntoken for it to be considered like so.\n\nHow are the shared credentials shared?\n======================================\n\nOkay, on to the actual details.\n\nThe server gives you a session token, that you'll need to derive to get the\nhawk credentials.\n\nDo an HKDF derivation on the given session token. You'll need to use the\nfollowing parameters::\n\n .. code-block:: python\n\n key_material = HKDF(hawk_session, '', 'identity.mozilla.com/picl/v1/sessionToken', 32*2)\n\nThe key material you'll get out of the HKDF needs to be separated into two\nparts, the first 32 hex characters are the ``hawk id``, and the next 32 ones are the\n``hawk key``::\n\n .. code-block:: python\n\n credentials = {\n 'id': keyMaterial[0:32]\n 'key': keyMaterial[32:64]\n 'algorithm': 'sha256'\n }\n\nRun tests\n=========\n\nTo run test, you can use tox::\n\n .. code-block:: bash\n\n tox\n\n\nCHANGELOG\n=========\n\n1.0.0 (2015-12-15)\n------------------\n\n- Simplified API for using HawkAuth when the id and key are known. (#8)\n- Added support for overriding the default algorithm (sha256) when deriving\n credentials from the hawk session token, via a new ``algorithm`` parameter.\n\nSee the README for migration advice if you use the ``credentials`` parameter.\n\n\n0.2.1 (2015-10-14)\n------------------\n\n- Make sure the requests json parameter is handled properly. (#7)\n\n\n0.2.0 (2015-05-19)\n------------------\n\n- Fix encoding error in setup.py with Python 3.4\n- Add a configuration parameter in order to be able to set the\n timestamp to use.\n\n\n0.1.2 (2014-08-13)\n------------------\n\n- Add Python3 support\n\n\n0.1.1 (2014-07-21)\n------------------\n\n- First version", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mozilla-services/requests-hawk", "keywords": "authentication token hawk requests", "license": "Apache License (2.0)", "maintainer": "", "maintainer_email": "", "name": "requests-hawk", "package_url": "https://pypi.org/project/requests-hawk/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/requests-hawk/", "project_urls": { "Homepage": "https://github.com/mozilla-services/requests-hawk" }, "release_url": "https://pypi.org/project/requests-hawk/1.0.0/", "requires_dist": [ "requests (!=2.8.0)", "mohawk" ], "requires_python": "", "summary": "requests-hawk", "version": "1.0.0" }, "last_serial": 1863278, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "362889f8a45b584f49ecc8ca73f7d147", "sha256": "21d86745122961bbdeaaf3e27cb3c49444e86d23d1613ab73a63d7cf2b83bb62" }, "downloads": -1, "filename": "requests-hawk-0.0.1.tar.gz", "has_sig": false, "md5_digest": "362889f8a45b584f49ecc8ca73f7d147", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3632, "upload_time": "2014-07-16T12:07:12", "url": "https://files.pythonhosted.org/packages/30/fe/f70f069bf2552a5e516bf3e4f753c009c06fdf4f65bfdccc596d6ae9ab31/requests-hawk-0.0.1.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "47f7e1e3298feda388a4d175e2510152", "sha256": "d707471984ca81054f518ac20811353a959a02f4701fe48b7dbaa114e3c5bacb" }, "downloads": -1, "filename": "requests-hawk-0.1.0.tar.gz", "has_sig": false, "md5_digest": "47f7e1e3298feda388a4d175e2510152", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4344, "upload_time": "2014-07-16T15:17:56", "url": "https://files.pythonhosted.org/packages/83/42/da052293f683320409dbf5f5686505b4ac9fd1173a84456c38002246fb0e/requests-hawk-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "fb3d38fe55e30dc9c1def3b01aa1450d", "sha256": "dde0d996e79fb1c2a92a9ed94c6876d7980c1b13abd302f547c44c0d70fc5fa9" }, "downloads": -1, "filename": "requests-hawk-0.1.1.tar.gz", "has_sig": false, "md5_digest": "fb3d38fe55e30dc9c1def3b01aa1450d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4527, "upload_time": "2014-07-21T09:02:39", "url": "https://files.pythonhosted.org/packages/59/91/fa63a1a1ae8e14bbb4fda28296038b768eef786a48d1241e0f08cb49b7f7/requests-hawk-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "80198ae064b15cf73e3f5f9aad97e002", "sha256": "304c1329dbce1b2d2406d0d1616bc758a6c8f808bdc49b1b177d6fafd2298432" }, "downloads": -1, "filename": "requests-hawk-0.1.2.tar.gz", "has_sig": false, "md5_digest": "80198ae064b15cf73e3f5f9aad97e002", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4820, "upload_time": "2014-08-13T10:24:29", "url": "https://files.pythonhosted.org/packages/c4/1b/91061085e8ffc5998198b58d5656037c1d72f6bbc2754119b87a16155261/requests-hawk-0.1.2.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "80c29da64aad146754cf8756d51b4861", "sha256": "6752f97609e3b694b8da33f84fde855780088a5fc2f95aa3c39b7af6175172a4" }, "downloads": -1, "filename": "requests-hawk-0.2.0.zip", "has_sig": false, "md5_digest": "80c29da64aad146754cf8756d51b4861", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10844, "upload_time": "2015-05-19T13:08:30", "url": "https://files.pythonhosted.org/packages/14/7e/e3f0cc7ef999cb1aad3a8c362cf13a178fa32f68989cf2e9eb97fd7560fb/requests-hawk-0.2.0.zip" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "0130c6fe593a08949f7b7ceb36c3315d", "sha256": "e77603dfc4800af33b2808c6b6003d1faae5aef9cf1e3988620de3564be8f61a" }, "downloads": -1, "filename": "requests_hawk-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0130c6fe593a08949f7b7ceb36c3315d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8148, "upload_time": "2015-10-14T10:29:29", "url": "https://files.pythonhosted.org/packages/a2/b9/7f10fbf6c977e58d150128429413110b7f1a6b6dbd6e458c40673eb45f80/requests_hawk-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "104fbd8630e724ddb15a99886caf0ac7", "sha256": "c7ddaf87847db29556585daf412d1997c38543bc23f1691151be3de87e0c7746" }, "downloads": -1, "filename": "requests-hawk-0.2.1.tar.gz", "has_sig": false, "md5_digest": "104fbd8630e724ddb15a99886caf0ac7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5555, "upload_time": "2015-10-14T10:29:39", "url": "https://files.pythonhosted.org/packages/c6/54/8ead9fe140f0b65021646db83a0e9cc2958b2a85c0119f7697bd180292e5/requests-hawk-0.2.1.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "621d1ba4dabfc3ace8a3472753807d04", "sha256": "c2626ab31ebef0c81b97781c44c2275bfcc6d8e8520fc4ced495f0f386f8fe26" }, "downloads": -1, "filename": "requests_hawk-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "621d1ba4dabfc3ace8a3472753807d04", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9005, "upload_time": "2015-12-15T13:53:12", "url": "https://files.pythonhosted.org/packages/3b/6a/d1aa3fab0b788bf4cf3d60898ff6b80852c8a6d82a8a7ac6d163487b8e30/requests_hawk-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3a8e5236f8456a9c7c021d78f92a8891", "sha256": "aef0dff8053dcae2057774516386bed0a3bc03fabea9e18f3aa98f02672ea5d0" }, "downloads": -1, "filename": "requests-hawk-1.0.0.tar.gz", "has_sig": false, "md5_digest": "3a8e5236f8456a9c7c021d78f92a8891", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6285, "upload_time": "2015-12-15T13:53:29", "url": "https://files.pythonhosted.org/packages/8a/62/e89d4e23847f74f56c66a0ae76c17e356338a0fe7bd352842647f5877a07/requests-hawk-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "621d1ba4dabfc3ace8a3472753807d04", "sha256": "c2626ab31ebef0c81b97781c44c2275bfcc6d8e8520fc4ced495f0f386f8fe26" }, "downloads": -1, "filename": "requests_hawk-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "621d1ba4dabfc3ace8a3472753807d04", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9005, "upload_time": "2015-12-15T13:53:12", "url": "https://files.pythonhosted.org/packages/3b/6a/d1aa3fab0b788bf4cf3d60898ff6b80852c8a6d82a8a7ac6d163487b8e30/requests_hawk-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3a8e5236f8456a9c7c021d78f92a8891", "sha256": "aef0dff8053dcae2057774516386bed0a3bc03fabea9e18f3aa98f02672ea5d0" }, "downloads": -1, "filename": "requests-hawk-1.0.0.tar.gz", "has_sig": false, "md5_digest": "3a8e5236f8456a9c7c021d78f92a8891", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6285, "upload_time": "2015-12-15T13:53:29", "url": "https://files.pythonhosted.org/packages/8a/62/e89d4e23847f74f56c66a0ae76c17e356338a0fe7bd352842647f5877a07/requests-hawk-1.0.0.tar.gz" } ] }