{ "info": { "author": "Lorenzo Mele", "author_email": "greenkey@loman.it", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "eddie\n=========\n\n|Build Status|\n\n``eddie`` is a library you can use to create your own chat bots in\nseconds.\n\nThis is a very young library, any request/suggestion/help will be very\nappreciated. For them, create an issue or contact me!\n\nInstall\n-------\n\nYou can install eddie using just pip:\n\n.. code:: shell\n\n $ pip install eddie\n\nIf you want the latest version download this repository in your project or\nusing pip:\n\n.. code:: shell\n\n $ pip install git+https://github.com/greenkey/eddie.git\n\nUsage\n-----\n\nYou have to define your bot class, extending the default ``Bot`` class:\n\n.. code:: python\n\n >>> from eddie.bot import Bot\n >>> class MyBot(Bot):\n ... pass\n ... \n >>> b = MyBot()\n >>> b\n <__main__.MyBot object at 0x7f16e79f3940>\n\nOf course you'll want to define some bahaviour, the following chapters\nteach you how to do it.\n\nDefining a default response\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n >>> from eddie.bot import Bot\n >>> class MyBot(Bot):\n ... def default_response(self, in_message):\n ... # setting echo as default response\n ... return in_message\n ... \n >>> b = MyBot()\n >>> b.process(\"Hello!\")\n 'Hello!'\n >>> b.process(\"Goodbye!\")\n 'Goodbye!'\n\nDefining commands\n~~~~~~~~~~~~~~~~~\n\nJust define a method of your Bot class using the ``command`` decorator.\n\n.. code:: python\n\n >>> from eddie.bot import Bot, command\n >>> class MyBot(Bot):\n ... @command\n ... def hello(self):\n ... return \"hello!\"\n ... \n >>> bot = MyBot()\n >>> bot.process(\"/hello\") # the default command prepend is \"/\"\n 'hello!'\n\nDefining interfaces\n~~~~~~~~~~~~~~~~~~~\n\nA bot running in local would be pretty useless, isn't it?\n\nThe simplest interface we can give to our bot is the http one.\n\n.. code:: python\n\n >>> from eddie.bot import Bot\n >>> from eddie.endpoints import HttpEndpoint\n >>> class MyBot(Bot):\n ... def default_response(self, in_message):\n ... return in_message\n ... \n >>> bot = MyBot()\n >>> ep = HttpEndpoint()\n >>> bot.add_endpoint(ep)\n >>> bot.run()\n\nThen you can send message to the bot using simple GET requests:\n``http://localhost:8000/process?in_message=hello``\n\nNote: default port is 8000, if it is already used, ``HttpEndpoint`` will\nuse the first free port after 8000 (8001, 8002...).\n\nThe output using the example will be a json with the message:\n``{\"out_message\": \"hello\"}``\n\nTelegram\n~~~~~~~~\n\nYes, you can easily connect your bot with the Telegram API, thanks to\nthe\n`python-telegram-bot `__\nlibrary.\n\nYou don't have to worry about nothing, except getting a token from the\n`BotFather `__ and passing it\nto your bot.\n\n.. code:: python\n\n >>> from eddie.bot import Bot\n >>> from eddie.endpoints import TelegramEndpoint\n >>> class MyBot(Bot):\n ... def default_response(self, in_message):\n ... return in_message\n ... \n >>> bot = MyBot()\n >>> ep = TelegramEndpoint(\n ... token='123:ABC'\n ... )\n >>> bot.add_endpoint(ep)\n >>> bot.run()\n\nTwitter\n~~~~~~~~\n\nIt's not a proper bot framework, but with ``eddie`` you can have a bot in\nTwitter too, thanks to the `tweepy `__\nlibrary.\n\nJust follow the instrunction on `how to create a Twitter App `__\n, get all the tokens and use them to instantiate the ``TwitterEndpoint``.\n\n.. code:: python\n\n >>> from eddie.bot import Bot\n >>> from eddie.endpoints import TwitterEndpoint\n >>> class MyBot(Bot):\n ... def default_response(self, in_message):\n ... return in_message\n ... \n >>> bot = MyBot()\n >>> ep = TwitterEndpoint(\n ... consumer_key='your consumer_key',\n ... consumer_secret='your consumer_secret',\n ... access_token='your access_token',\n ... access_token_secret='your access_token_secret'\n ... )\n >>> bot.add_endpoint(ep)\n >>> bot.run()\n\nLogging\n~~~~~~~\n\nThis library uses the logging module. To set up logging to standard\noutput, put:\n\n.. code:: python\n\n import logging\n logging.basicConfig(level=logging.DEBUG)\n\nat the beginning of your script.\n\nGet involved\n------------\n\nIf you want to contribute, download the repository, then:\n\n.. code:: shell\n\n $ virtualenv ~/.venv/eddie # not required but highly suggested\n $ source ~/.venv/eddie/bin/activate\n $ pip install -r requirements-dev.txt # install all the requirements\n $ pytest\n\n.. |Build Status| image:: https://travis-ci.org/greenkey/eddie.svg?branch=master\n :target: https://travis-ci.org/greenkey/eddie\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/greenkey/eddie/", "keywords": "chat,chatbot,telegram,twitter", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "eddie", "package_url": "https://pypi.org/project/eddie/", "platform": "any", "project_url": "https://pypi.org/project/eddie/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/greenkey/eddie/" }, "release_url": "https://pypi.org/project/eddie/0.9.5/", "requires_dist": null, "requires_python": null, "summary": "A lib to create chatbots", "version": "0.9.5" }, "last_serial": 2857479, "releases": { "0.9.4": [ { "comment_text": "", "digests": { "md5": "307edae7451f7a41508c5220e497f3f2", "sha256": "408d4385df6dfb6244b8470b4b66c657df479aa9acdf70d1c988d3af2c39a587" }, "downloads": -1, "filename": "eddie-0.9.4.tar.gz", "has_sig": false, "md5_digest": "307edae7451f7a41508c5220e497f3f2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14376, "upload_time": "2017-04-21T23:19:34", "url": "https://files.pythonhosted.org/packages/ed/de/bdcb240ac131936f79f22778a627de7d353573ab0561f61f2be5fd71e80e/eddie-0.9.4.tar.gz" } ], "0.9.5": [ { "comment_text": "", "digests": { "md5": "d24eef0f91c3cd48d16dffcbdc5c0e4e", "sha256": "2263351a8443c5b60780cdf44d944b985ca9b9b396a9fc115f190e2ed23bf6e9" }, "downloads": -1, "filename": "eddie-0.9.5.tar.gz", "has_sig": false, "md5_digest": "d24eef0f91c3cd48d16dffcbdc5c0e4e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14755, "upload_time": "2017-05-07T18:15:24", "url": "https://files.pythonhosted.org/packages/dc/2a/d4d1b1f7024e6f0daa9ff50f5f6171620d6867d7cb11ff1fa82adfd548bf/eddie-0.9.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d24eef0f91c3cd48d16dffcbdc5c0e4e", "sha256": "2263351a8443c5b60780cdf44d944b985ca9b9b396a9fc115f190e2ed23bf6e9" }, "downloads": -1, "filename": "eddie-0.9.5.tar.gz", "has_sig": false, "md5_digest": "d24eef0f91c3cd48d16dffcbdc5c0e4e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14755, "upload_time": "2017-05-07T18:15:24", "url": "https://files.pythonhosted.org/packages/dc/2a/d4d1b1f7024e6f0daa9ff50f5f6171620d6867d7cb11ff1fa82adfd548bf/eddie-0.9.5.tar.gz" } ] }