{ "info": { "author": "Charles Thomas", "author_email": "ch@rlesthom.as", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 2.7", "Topic :: Communications :: Email", "Topic :: Database", "Topic :: Internet :: WWW/HTTP :: Session", "Topic :: Security", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "====\nmoth\n====\n.. image:: https://travis-ci.org/charlesthomas/moth.png?branch=master\n :target: https://travis-ci.org/charlesthomas/moth\n\n**Moth** was conceived to be used as an email-only authentication scheme (mail\nauth -> mauth -> moth), however, it is generic enough to be used for pretty much\nany token-based authentication.\n\nRelevant Links\n--------------\n- `moth in PyPI`_\n- `moth on Github`_\n- `moth documentation`_\n- `moth build status`_\n- `moth author`_\n\nSynchronous vs. Asynchronous\n----------------------------\nTo create a synchronous moth object: ::\n\n from moth import Moth\n moth_object = Moth()\n\nTo create an asynchronous moth object: ::\n\n from moth import AsyncMoth\n moth_object = AsyncMoth()\n\nAll method calls are supported and identically named in **Moth** vs.\n**AsyncMoth**. For the rest of this README, **Moth** will refer to both **Moth**\nand **AsyncMoth** unless stated otherwise.\n\nInitialization\n--------------\nInitiating **Moth** takes the credentials for creating a connection to MongoDB,\nas well as the database name (which defaults to \"moth\").\n\n``AsyncMoth.__init__()`` **blocks while creating a connection.** It is the only\nmethod which does so. It is recommended that you initialize **AsyncMoth** as\npart of your tornado server's startup.\n\nCreating Tokens\n---------------\nCalling ``moth.create_token()`` generates a random token and stores it along\nwith email address and optional IP address, expiration (in days), and retval.\nThe method returns the token.\n\nAuthenticating Tokens\n---------------------\nCalling ``moth.auth_token()`` queries mongo for the passed email/token\ncombination. If IP address is in the record returned from mongo, it is\nvalidated. If expiration is returned, it is compared to ``datetime.now()``\n\n**If either IP address or expiration fails to validate, the token will be\ndeleted.**\n\nIf the token validates, retval is queried. If a retval exists, it is returned.\nIf it doesn't, ``moth.auth_token()`` returns True.\n\nAdditional Methods\n------------------\nAll other methods are fairly self explanatory, and/or mostly for internal\npurposes. Read the code to figure out how it works.\n\nWhat is retval?\n---------------\nretval is the value that will be returned when ``moth.auth_token()`` is\nsuccessful. It is **completely optional**. If you don't pass a retval to\n``moth.create_token()``, and don't call ``moth.set_retval()``, then\n``moth.auth_token()`` will return True on successful calls.\n\nWhy use it?\n~~~~~~~~~~~\nFor the project I'm working on which lead to the creation of **Moth**, retval is\nan OAuth token. When I call ``moth.auth_token()``, I validate the moth token,\nwhich gives me the user's OAuth token for making API calls.\n\nRequirements\n------------\n**Moth** requires **Motor**, as well as **Tornado** and **Pymongo** (which are\nboth installed via **Motor**).\n\nExamples\n--------\nExamples can be found on `ReadTheDocs`_\n\n.. _moth in PyPI: https://pypi.python.org/pypi/moth\n.. _moth on Github: https://github.com/charlesthomas/moth\n.. _moth documentation: https://moth.readthedocs.org/en/latest/moth.html\n.. _moth build status: https://travis-ci.org/charlesthomas/moth\n.. _moth author: mailto:ch@rlesthom.as\n.. _ReadTheDocs: http://moth.readthedocs.org/en/latest/examples/html", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://moth.readthedocs.org", "keywords": null, "license": "Copyright (c) 2014 Charles Thomas\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", "maintainer": null, "maintainer_email": null, "name": "moth", "package_url": "https://pypi.org/project/moth/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/moth/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://moth.readthedocs.org" }, "release_url": "https://pypi.org/project/moth/2.1.1/", "requires_dist": null, "requires_python": null, "summary": "token system using MongoDB", "version": "2.1.1" }, "last_serial": 993087, "releases": { "2.0.0": [ { "comment_text": "", "digests": { "md5": "16285954ce14d4ff2d6c980999db2e1b", "sha256": "df92d894cc664ca36aa810e90c58c7d1a42b77737543dbb22d0042a8159f4c21" }, "downloads": -1, "filename": "moth-2.0.0.tar.gz", "has_sig": false, "md5_digest": "16285954ce14d4ff2d6c980999db2e1b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5382, "upload_time": "2013-05-09T00:56:07", "url": "https://files.pythonhosted.org/packages/a1/9d/d9b99ea6f5bcaeaff67c7d0962c987be66ab267954c0489731eef12398c7/moth-2.0.0.tar.gz" } ], "2.0.1": [ { "comment_text": "", "digests": { "md5": "cac4839132ed62541ab7472db19a208c", "sha256": "0b97dfffb162821262dbfe9712c80ad44383c9734398afabc72dfd44d07d9de6" }, "downloads": -1, "filename": "moth-2.0.1.tar.gz", "has_sig": false, "md5_digest": "cac4839132ed62541ab7472db19a208c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5402, "upload_time": "2013-05-09T23:55:30", "url": "https://files.pythonhosted.org/packages/a8/72/6e968f1ed8749665427b05aedbd2b5e8ba37943d4bfc2edd7271526789a4/moth-2.0.1.tar.gz" } ], "2.0.2": [ { "comment_text": "", "digests": { "md5": "5051a6f7dd7490ac7f192cd81174196c", "sha256": "9c754d7301233c9d7596a06663e122d72b26673332d7e335bf04a53addd431fa" }, "downloads": -1, "filename": "moth-2.0.2.tar.gz", "has_sig": false, "md5_digest": "5051a6f7dd7490ac7f192cd81174196c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5409, "upload_time": "2014-01-16T20:55:50", "url": "https://files.pythonhosted.org/packages/17/33/218dc70b79d09c6e60c30629644bdfbb4a87aa7a72a2881881f83dface71/moth-2.0.2.tar.gz" } ], "2.1.0": [ { "comment_text": "", "digests": { "md5": "e1d21257736511e80e923f16cc9b4c0d", "sha256": "8e4f84282f4fc707f665f8c273c3fb86914b21ec15f21c75463b469a8690fe2a" }, "downloads": -1, "filename": "moth-2.1.0.tar.gz", "has_sig": false, "md5_digest": "e1d21257736511e80e923f16cc9b4c0d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5479, "upload_time": "2014-01-30T22:17:58", "url": "https://files.pythonhosted.org/packages/16/b4/8efb423927018ea9f73314968287bcfd9c3a5f86a8f203daae1a2abcda57/moth-2.1.0.tar.gz" } ], "2.1.1": [ { "comment_text": "", "digests": { "md5": "662416cd932d419e39bdf9a60dc16a1d", "sha256": "29e9cd6b735e99d658f2b6377193e985adb4785eeb407f38301fbbc349dc37bc" }, "downloads": -1, "filename": "moth-2.1.1.tar.gz", "has_sig": false, "md5_digest": "662416cd932d419e39bdf9a60dc16a1d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5377, "upload_time": "2014-02-07T02:42:17", "url": "https://files.pythonhosted.org/packages/25/30/9760875c4803fba53389dc9554d9ec02b97cb85d826858417da75ababa09/moth-2.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "662416cd932d419e39bdf9a60dc16a1d", "sha256": "29e9cd6b735e99d658f2b6377193e985adb4785eeb407f38301fbbc349dc37bc" }, "downloads": -1, "filename": "moth-2.1.1.tar.gz", "has_sig": false, "md5_digest": "662416cd932d419e39bdf9a60dc16a1d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5377, "upload_time": "2014-02-07T02:42:17", "url": "https://files.pythonhosted.org/packages/25/30/9760875c4803fba53389dc9554d9ec02b97cb85d826858417da75ababa09/moth-2.1.1.tar.gz" } ] }