{ "info": { "author": "Jessamyn Smith", "author_email": "jessamyn.smith@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: End Users/Desktop", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries", "Topic :: Software Development", "Topic :: Utilities" ], "description": "TwitterBot\n==========\n\n|Build Status| |Coverage Status| |PyPI Version| |Supported Python Versions| |Downloads|\n\nEasy-to-use TwitterBot that posts new messages and replies to mentions.\nBuilt on the popular twitter_ package. Please read Twitter's\n`Automation rules and best practices`_ before setting up a bot.\n\nFeatures\n--------\n\nYou can use Twitterbot to:\n - Post a new message.\n - Reply to any twitter mentions with a message.\n\nInstallation\n------------\n\nYou can get twitterbot from PyPI with:\n\n::\n\n pip install twitterbot\n\nThe development version can be installed with:\n\n::\n\n pip install -e git://github.com/jessamynsmith/twitterbot.git#egg=twitterbot\n\nIf you are developing locally, your version can be installed from the\nproject directory with:\n\n::\n\n python setup.py.install\n\nUsage\n-----\n\n**Quick Start**\n\nBy default, settings are populated from environment variables. The authentication variables\nare required and can be `obtained from your Twitter account`_. It is recommended that you read\nTwitter's `Automation rules and best practices`_ before setting up a bot.\n\n- TWITTER\\_CONSUMER\\_KEY\n- TWITTER\\_CONSUMER\\_SECRET\n- TWITTER\\_OAUTH\\_SECRET\n- TWITTER\\_OAUTH\\_TOKEN\n\nYou can optionally set the following environment variables:\n\n- TWITTER_MESSAGE_PROVIDER\n Provides messages to be posted. Defaults to 'messages.HelloWorldMessageProvider',\n a simple provider that always returns \"Hello World!\"\n- TWITTER_SINCE_ID_PROVIDER\n Provides storage for since_id. Twitter uses sinFile in which to store last retrieved since_id.\n Defaults to using the filesystem ('./.since_id.txt'). You may set a value in the file to\n start handling mentions at a particular message id.\n- TWITTER_DRY_RUN\n If set to True, messages will be logged rather than actually posting them to Twitter.\n\nThe underquotedbot project is a `working example`_ of using the twitterbot library to build a\nbot that is deployed to heroku and runs the twitter account `@the_underquoted`_.\n\n**Setting a Custom Message Provider**\n\nYou can inject your own message provider by setting the following environment variable:\n\n::\n\n export TWITTER_MESSAGE_PROVIDER='bot.messages.MyMessageProvider'\n\nYou would then need to create a bot.messages module with a\nMyMessageProvider class that implements the ``create()`` method,\ne.g.\n\n::\n\n class MyMessageProvider(object):\n\n def create(self, mention, max_message_length):\n \"\"\"\n Create a message\n :param mention: JSON object containing mention details from Twitter\n :param max_message_length: Maximum allowable length for created message\n :return: a message\n \"\"\"\n return \"This is my message!\"\n\n**Setting a Custom Since_id Provider**\n\nThe default is to use the FileSystemSinceIdProvider. Using the file system will NOT work correctly\non Heroku or any other host with an ephemeral file system. If you cannot rely on the file system,\nyou MUST specify a different SinceIdProvider.\n\nTwitterBot comes with a Redis provider. By default, localhost will be used for redis. To use it, \nyou must first install redis on your system. I recommend using homebrew on OSX:\n\n::\n\n brew install redis\n brew services start redis\n\nOnce you have redis installed or available as a service, you can install the python redis package and set\nenvironment variables to configure the provider. \n\n::\n\n pip install redis\n export TWITTER_SINCE_ID_PROVIDER='twitter_bot.since_id.redis_provider.RedisSinceIdProvider'\n export REDIS_URL=redis://:@somehost:someport # Optional, defaults to localhost\n\nYou can inject a custom since_id provider by setting the following environment variable:\n\n::\n\n export TWITTER_SINCE_ID_PROVIDER='bot.since_id.MySinceIdProvider'\n\nYou would then need to create a bot.since_id module with a MySinceIdProvider class\nthat implements the ``get()``, ``set()``, and ``delete()`` methods,\ne.g.\n\n::\n\n # since_id.py\n import os\n from twitter_bot import SettingsError\n from twitter_bot import BaseSinceIdProvider\n\n class MySinceIdProvider(BaseSinceIdProvider):\n\n def __init__(self, source=None):\n if not source:\n source = os.environ.get('TWITTER_SINCE_ID_SOURCE')\n if not source:\n raise SettingsError(\"You must supply source or set the TWITTER_SINCE_ID_SOURCE \"\n \"environment variable.\")\n self.source = source\n\n def get(self):\n return self.source.get('since_id')\n\n def set(self, since_id):\n return self.source.set('since_id', since_id)\n\n def delete(self):\n return self.source.delete('since_id')\n\n**Overriding Settings**\n\nIf you require more control over settings, you can subclass Settings:\n\n::\n\n from twitter_bot import Settings\n\n class MyBotSettings(Settings):\n def __init__(self):\n super(MyBotSettings, self).__init__()\n self.MESSAGE_PROVIDER = 'bot.messages.MyProvider'\n\n**Automating the bot**\n\nTo run the bot as a cron job or Heroku scheduler task, you can make make a small script that\nuses the provided runner. If you have customized settings, import your own settings class rather\nthan the provided settings.\n\n::\n\n #!/usr/bin/env python\n # runner.py\n\n import sys\n\n from twitter_bot import BotRunner, Settings\n\n if __name__ == '__main__':\n if len(sys.argv) != 2:\n print(\"You must specify a single command, either 'post_message' or 'reply_to_mentions'\")\n result = 1\n else:\n result = BotRunner().go(Settings(), sys.argv[1])\n sys.exit(result)\n\nThen call the script as follows:\n\n::\n\n $ ./runner.py post_message\n $ ./runner.py reply_to_mentions\n\nDevelopment\n-----------\n\nFork the project on github and git clone your fork, e.g.:\n\n::\n\n git clone https://github.com//twitterbot.git\n\nSet up virtualenv:\n\n::\n\n mkvirtualenv twitterbot\n pip install -r requirements/package.txt -r requirements/test.txt\n\nRun tests with coverage (should be 100%) and check code style:\n\n::\n\n coverage run -m nose\n coverage report -m\n flake8\n\nVerify all supported Python versions:\n\n::\n\n pip install tox\n tox\n\nRun bot:\n\n::\n\n $ ./bin/runner.py reply_to_mentions # Check twitter stream for mentions, and reply\n $ ./bin/runner.py post_message # Post a message to twitter\n\n\nValidating The Project Locally\n------------------------------\n\nThe CircleCI build can be validated locally, using the CircleCI CLI and docker. \n\nFirst, install `Docker Desktop`_\n\nInstall the CircleCI CLI, e.g. using homebrew on OSX:\n\n::\n\n $ brew install circleci\n\nThen, you can validate it by running this command in the terminal:\n\n::\n\n $ circleci config validate\n\nOnce you know your config is valid, you can test it.\nThe CLI allows you to run a single job from CircleCI on your desktop using docker:\n\n::\n\n $ circleci local execute --job build\n\nFor more information, see the [CircleCI docs](https://circleci.com/docs/2.0/local-cli/#validate-a-circleci-config)\n\n\n.. |Build Status| image:: https://img.shields.io/circleci/project/github/jessamynsmith/twitterbot.svg\n :target: https://circleci.com/gh/jessamynsmith/twitterbot\n :alt: Build status\n.. |Coverage Status| image:: https://img.shields.io/coveralls/jessamynsmith/twitterbot.svg\n :target: https://coveralls.io/r/jessamynsmith/twitterbot?branch=master\n :alt: Coverage status\n.. |PyPI Version| image:: https://img.shields.io/pypi/v/twitterbot.svg\n :target: https://pypi.python.org/pypi/twitterbot\n :alt: Latest PyPI version\n.. |Supported Python Versions| image:: https://img.shields.io/pypi/pyversions/twitterbot.svg\n :target: https://pypi.python.org/pypi/twitterbot\n :alt: Supported Python versions\n.. |Downloads| image:: https://img.shields.io/pypi/dm/twitterbot.svg\n :target: https://pypi.python.org/pypi/twitterbot\n :alt: Number of PyPI downloads\n.. _`Automation rules and best practices`: https://support.twitter.com/articles/76915-automation-rules-and-best-practices\n.. _`working example`: https://github.com/jessamynsmith/underquotedbot\n.. _`@the_underquoted`: https://twitter.com/the_underquoted/\n.. _`obtained from your Twitter account`: https://dev.twitter.com/oauth/overview/application-owner-access-tokens/\n.. _twitter: https://pypi.python.org/pypi/twitter\n.. _`Docker Desktop`: https://www.docker.com/products/docker-desktop", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/jessamynsmith/twitterbot/archive/v0.3.4.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jessamynsmith/twitterbot", "keywords": "twitter,bot,web 2.0,command-line tools", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "twitterbot", "package_url": "https://pypi.org/project/twitterbot/", "platform": "", "project_url": "https://pypi.org/project/twitterbot/", "project_urls": { "Download": "https://github.com/jessamynsmith/twitterbot/archive/v0.3.4.tar.gz", "Homepage": "https://github.com/jessamynsmith/twitterbot" }, "release_url": "https://pypi.org/project/twitterbot/0.3.4/", "requires_dist": null, "requires_python": "", "summary": "Configurable bot that replies to mentions and posts messages to twitter", "version": "0.3.4" }, "last_serial": 5343894, "releases": { "0.1.4": [ { "comment_text": "", "digests": { "md5": "53c9c8a0a3a4aac16812cedc5f7b651f", "sha256": "4cc19995703eebce8be0accf5540e6f6d42ce25a67337a0e15f6697b429d13e3" }, "downloads": -1, "filename": "twitterbot-0.1.4.tar.gz", "has_sig": false, "md5_digest": "53c9c8a0a3a4aac16812cedc5f7b651f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6509, "upload_time": "2015-04-22T20:33:51", "url": "https://files.pythonhosted.org/packages/c1/e5/42ff23546122f97499b6b89c5abd09410b26f4a9ace58368d692d7e9284a/twitterbot-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "d370273cd98083ebcd10e27958063b84", "sha256": "1f7d892390493d6d79dd50a1409ab039f6016349546702d18d4b5582f1d2c5b7" }, "downloads": -1, "filename": "twitterbot-0.1.5.tar.gz", "has_sig": false, "md5_digest": "d370273cd98083ebcd10e27958063b84", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7162, "upload_time": "2015-04-22T20:49:00", "url": "https://files.pythonhosted.org/packages/5d/ca/b2cb3ea20f62003b381f7f753229ec2985eb33f8e51dde135728b811d7e4/twitterbot-0.1.5.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "3599e21865fe321cbe5ab6eaab037a2c", "sha256": "0925971b0b9eb29a61ec7cff9ccb2322cbe18fbf95af3628398281ac790180cc" }, "downloads": -1, "filename": "twitterbot-0.1.7.tar.gz", "has_sig": false, "md5_digest": "3599e21865fe321cbe5ab6eaab037a2c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8083, "upload_time": "2015-04-23T02:44:04", "url": "https://files.pythonhosted.org/packages/ae/4f/e04a4e21fe7b9359030172cf0de554f7f94dbef726cee4e59cec114c5dec/twitterbot-0.1.7.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "e98ce9448e0ce144fb1a086a866bbba3", "sha256": "19f1a61206f1a7cf7b4253f2bd707890aee51c5977be39301f94d71c99007602" }, "downloads": -1, "filename": "twitterbot-0.2.0.tar.gz", "has_sig": false, "md5_digest": "e98ce9448e0ce144fb1a086a866bbba3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8235, "upload_time": "2015-04-23T05:23:20", "url": "https://files.pythonhosted.org/packages/bb/d9/aff9987b1563245fd7d45fc8220d6449c936c92d0b1d5a26a1ca268eeb6e/twitterbot-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "380994288fa04c398ebf181cbe4c518e", "sha256": "abef39d85d543977b75076562db7c97e926e71f301e6c85a4f5b0f1ae98a3cc8" }, "downloads": -1, "filename": "twitterbot-0.2.1.tar.gz", "has_sig": false, "md5_digest": "380994288fa04c398ebf181cbe4c518e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8242, "upload_time": "2015-04-23T05:33:47", "url": "https://files.pythonhosted.org/packages/ac/d8/e56cc83b9573607b133b49509b05e062d9171d29f92f405d51290d58fdb6/twitterbot-0.2.1.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "f4904d35179ebc99b41a4c6301111fb2", "sha256": "c1b3fd343477422aec5bff378e00183a353f6b38c8b03954589c2a9dbf5ce3bf" }, "downloads": -1, "filename": "twitterbot-0.2.3.tar.gz", "has_sig": false, "md5_digest": "f4904d35179ebc99b41a4c6301111fb2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8153, "upload_time": "2015-04-23T14:01:45", "url": "https://files.pythonhosted.org/packages/66/2c/a0eab7a744eb5aa5b82dc3c99c9abb19bc53460852995287ace505b4bdac/twitterbot-0.2.3.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "96019802582d3b063840eef3a641938d", "sha256": "4b2ada27e6fcd76c6199d8474eb7755b311a51d8504aaadbaf45f3b8c64ded8e" }, "downloads": -1, "filename": "twitterbot-0.3.0.tar.gz", "has_sig": false, "md5_digest": "96019802582d3b063840eef3a641938d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11558, "upload_time": "2015-04-23T20:08:54", "url": "https://files.pythonhosted.org/packages/4c/da/3b4add2da594127c0d5698ea1130edcd34e680125301cb38ca5d85420a4a/twitterbot-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "632e2cc2952d80e625a477d2c14eda6f", "sha256": "e7eca9f53095088e788348fbcd4feeefd705ee5d51b5f04c7c3987779ce22240" }, "downloads": -1, "filename": "twitterbot-0.3.1.tar.gz", "has_sig": false, "md5_digest": "632e2cc2952d80e625a477d2c14eda6f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11843, "upload_time": "2015-04-24T04:08:46", "url": "https://files.pythonhosted.org/packages/25/d4/744ad9558573ee4d4455b7717d4d2d5ee372f7fb9210568e8bba9545bf45/twitterbot-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "4dbbeb26b95bc4b53db2b6471121064c", "sha256": "4a73ca2f89eb4d76aabc8fd5c11afc0c2225ef0508dc1708ec10f4c3c179213a" }, "downloads": -1, "filename": "twitterbot-0.3.2.tar.gz", "has_sig": false, "md5_digest": "4dbbeb26b95bc4b53db2b6471121064c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11962, "upload_time": "2015-04-25T01:29:06", "url": "https://files.pythonhosted.org/packages/53/2e/57cda06753fb00723c97d9ba6f56d720f1ba9296c053d3540042da4eaa69/twitterbot-0.3.2.tar.gz" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "659e62ef1e1dede67f2e0bbc4324b387", "sha256": "c079de4a75584767266753ac0cd997b0619d01a5b522b4df208134bed59ac6b2" }, "downloads": -1, "filename": "twitterbot-0.3.3.tar.gz", "has_sig": false, "md5_digest": "659e62ef1e1dede67f2e0bbc4324b387", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11900, "upload_time": "2019-05-31T18:08:43", "url": "https://files.pythonhosted.org/packages/b7/f3/d69e61e86132d5b45348af512ca0340f29f5b622a91c8e7f0639d65e4ccb/twitterbot-0.3.3.tar.gz" } ], "0.3.4": [ { "comment_text": "", "digests": { "md5": "6a00de73a35b29d3d7b6c5c5d3be10af", "sha256": "fecd85f0cba19ec878022a47e1ce91cad74418dfb96e47ff18316517e9f769b3" }, "downloads": -1, "filename": "twitterbot-0.3.4.tar.gz", "has_sig": false, "md5_digest": "6a00de73a35b29d3d7b6c5c5d3be10af", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11863, "upload_time": "2019-05-31T18:14:53", "url": "https://files.pythonhosted.org/packages/6a/25/9d7a53b6fa1a56653239bb101137472d5f22b396225329ecf174470da634/twitterbot-0.3.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6a00de73a35b29d3d7b6c5c5d3be10af", "sha256": "fecd85f0cba19ec878022a47e1ce91cad74418dfb96e47ff18316517e9f769b3" }, "downloads": -1, "filename": "twitterbot-0.3.4.tar.gz", "has_sig": false, "md5_digest": "6a00de73a35b29d3d7b6c5c5d3be10af", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11863, "upload_time": "2019-05-31T18:14:53", "url": "https://files.pythonhosted.org/packages/6a/25/9d7a53b6fa1a56653239bb101137472d5f22b396225329ecf174470da634/twitterbot-0.3.4.tar.gz" } ] }