{ "info": { "author": "Zulko", "author_email": "UNKNOWN", "bugtrack_url": null, "classifiers": [], "description": "Twittcher\n==========\n\nTwittcher (for *twitter-watcher*) is a Python module to make bots that will watch a Twitter user page or search page, and react to the tweets they find.\n\nIt's simple, small (currently ~150 lines of code), and doesn't require any registration on Twitter or *dev.twitter.com*, as it doesn't depend on the Twitter API (instead it parses the HTML).\n\nTwittcher is an open-source software originally written by Zulko_, and released under the MIT licence. The project is hosted on Github_, where you can report bugs, propose improvements, etc.\n\nInstall\n--------\n\nIf you have `pip`, install twittcher by typing in a terminal:\n::\n \n (sudo) pip install twittcher\n\nElse, download the sources (on Github_ or PyPI_), and in the same directory as the `setup.py` file, type this in a terminal:\n::\n \n (sudo) python setup.py install\n\nTwittcher requires the Python package BeautifulSoup (a.k.a. bs4), which will be automatically installed when twittcher is installed.\n\n\nExamples of use\n----------------\n\nThere is currently no documentation for Twittcher, but the following examples should show you everything you need to get started.\n\n1. Print the tweets of a given user\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nEvery 120 seconds, print all the new tweets by John D. Cook:\n::\n \n from twittcher import UserWatcher\n UserWatcher(\"JohnDCook\").watch_every(120)\n\nResult:\n::\n \n Kicking off some simulations before I quit work for the day. #dejavu\n Author: JohnDCook\n Date: 15:43 - 24 juil. 2014\n Link: https://twitter.com/JohnDCook/status/492440083073859585\n \u201cToo often we enjoy the comfort of opinion without the discomfort of thought.\" -- John F. Kennedy,\n Author: JerryWeinberg\n Date: 13:18 - 24 juil. 2014\n Link: https://twitter.com/JerryWeinberg/status/492403371975114752\n\n \nThe default action of `UserWatcher` is to print the tweets, but you can ask any other action instead.\nFor instance, here is how to only print the tweets that are actually written by John D. Cook (not the ones he retweets):\n::\n \n from twittcher import UserWatcher\n \n def my_action(tweet):\n if tweet.username == \"JohnDCook\":\n print(tweet)\n\n UserWatcher(\"JohnDCook\", action=my_action).watch_every(120)\n\n\n2. Control a distant machine through Twitter !\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nEvery 60 seconds, for any of my new tweets of the form ``cmd: my_command``, run ``my_command`` in a terminal.\nUsing simple tweets I can control any distant computer running this script.\n::\n \n import subprocess\n from twittcher import UserWatcher\n\n def my_action(tweet):\n \"\"\" Execute the tweet's command, if any. \"\"\"\n if tweet.text.startswith(\"cmd: \"):\n subprocess.Popen( tweet.text[5:], shell=True )\n\n # Watch my account and react to my tweets\n bot = UserWatcher(\"Zulko___\", action=my_action)\n bot.watch_every(60)\n\nFor instance, the tweet ``cmd: firefox`` will open Firefox on the computer, and the tweet ``cmd: echo \"Hello\"`` will have the computer print Hello in a terminal.\n\n\n3. Watch search results and send alert mails\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nEvery 20 seconds, send me all the new tweets in the Twitter search results for `chocolate milk`.\n::\n \n from twittcher import TweetSender, SearchWatcher\n sender = TweetSender(smtp=\"smtp.gmail.com\", port=587,\n login=\"tintin.zulko@gmail.com\",\n password=\"fibo112358\", # be nice, don't try.\n to_addrs=\"tintin.zulko@gmail.com\", # where to send\n sender_id = \"chocolate milk\")\n bot = SearchWatcher(\"chocolate milk\", action=sender.send)\n bot.watch_every(20)\n\n4. Multibot watching\n~~~~~~~~~~~~~~~~~~~~~~~~\n\nIf you want to run several bots at once, make sure that you leave a few seconds between the requests of the different bots.\nHere is how you print the new tweets of John D. Cook, Mathbabe, and Eolas. Each of them is watched every minute, with 20 seconds between the requests of two bots:\n::\n \n import time\n import itertools\n from twittcher import UserWatcher\n \n bots = [ UserWatcher(user) for user in \n [\"JohnDCook\", \"mathbabedotorg\", \"Maitre_Eolas\"]]\n\n for bot in itertools.cycle(bots):\n bot.watch()\n time.sleep(20)\n\n\n5. Saving the tweets\n~~~~~~~~~~~~~~~~~~~~~~\n\nA bot can save to a file the tweets that it has already seen, so that in future sessions it will remember not to process these tweets again, in case they still appear on the watched page.\n::\n \n from twittcher import SearchWatcher\n bot = SearchWatcher(\"chocolate milk\", database=\"choco.db\")\n bot.watch_every(20)\n\n\n\n.. _PyPI: https://pypi.python.org/pypi/twittcher\n.. _Zulko : https://github.com/Zulko\n.. _Github: https://github.com/Zulko/twittcher", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": "Twitter tweet search bot", "license": "see LICENSE.txt", "maintainer": null, "maintainer_email": null, "name": "twittcher", "package_url": "https://pypi.org/project/twittcher/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/twittcher/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/twittcher/0.1.06/", "requires_dist": null, "requires_python": null, "summary": "Watch tweets on Twitter's user pages or search pages.", "version": "0.1.06" }, "last_serial": 1170984, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "19895e29dd29e081eae7ac83ca3b83be", "sha256": "77bc9f8c382bd3cb21fe152896804cdd6440e82eb3c0f43d67bff28506c4b86d" }, "downloads": -1, "filename": "twittcher-0.1.0.tar.gz", "has_sig": false, "md5_digest": "19895e29dd29e081eae7ac83ca3b83be", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5384, "upload_time": "2014-07-26T08:21:29", "url": "https://files.pythonhosted.org/packages/5c/ed/e4a5315b60ab2b5e7bc29dd372fc77f771b14bec6a3e6cba17aa13b1cf0f/twittcher-0.1.0.tar.gz" } ], "0.1.01": [ { "comment_text": "", "digests": { "md5": "97b18218e7d4b5b9ef56a3aadb6bf39c", "sha256": "8f17ca280ac9dd1f086d852e1b55998f5382142e8fea3406c056db7140bfbc3d" }, "downloads": -1, "filename": "twittcher-0.1.01.tar.gz", "has_sig": false, "md5_digest": "97b18218e7d4b5b9ef56a3aadb6bf39c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5686, "upload_time": "2014-07-26T08:56:01", "url": "https://files.pythonhosted.org/packages/eb/d1/86b5476aba5612eb3d5f086e0509dd08977ecfd4ae0c7605b5eb375f2127/twittcher-0.1.01.tar.gz" } ], "0.1.02": [ { "comment_text": "", "digests": { "md5": "6e724fc7ad7fb9affedd59a277dd3c70", "sha256": "9b4aff0d774f1ab558b6158850f31ae13f88b643de132dcc06827610f12bb657" }, "downloads": -1, "filename": "twittcher-0.1.02.tar.gz", "has_sig": false, "md5_digest": "6e724fc7ad7fb9affedd59a277dd3c70", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5686, "upload_time": "2014-07-26T08:59:43", "url": "https://files.pythonhosted.org/packages/1d/fb/baae2ce31704d61776763a3ad8800be0a911ea400155b03d78b1a5f1ba38/twittcher-0.1.02.tar.gz" } ], "0.1.03": [ { "comment_text": "", "digests": { "md5": "3151166d8594eb54177c4afe13400288", "sha256": "963ee92e22d91b08cb29162e8f1760866ae005ce65c8ac97d3162f6ca8fd4829" }, "downloads": -1, "filename": "twittcher-0.1.03.tar.gz", "has_sig": false, "md5_digest": "3151166d8594eb54177c4afe13400288", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5685, "upload_time": "2014-07-26T09:01:36", "url": "https://files.pythonhosted.org/packages/0c/47/b8afaf0b1a661e32f321ada64b536263d330fd38b0c3ee49c514ff9c8b07/twittcher-0.1.03.tar.gz" } ], "0.1.04": [ { "comment_text": "", "digests": { "md5": "6d4d968e5bfaeb17ca2c068769507e05", "sha256": "ddb70d3c52a24d0c6bf2d9bba1915e6ab07a35d484f2ddb8b027e967a3bf82b5" }, "downloads": -1, "filename": "twittcher-0.1.04.tar.gz", "has_sig": false, "md5_digest": "6d4d968e5bfaeb17ca2c068769507e05", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5699, "upload_time": "2014-07-26T09:23:55", "url": "https://files.pythonhosted.org/packages/12/67/97b764bda6d227d5a2569e5fdcede37f4a1e71ef2cca2a2d5e4d9c989765/twittcher-0.1.04.tar.gz" } ], "0.1.05": [ { "comment_text": "", "digests": { "md5": "af8a51b4202a45e307392815b86267e2", "sha256": "2b1d2d6b363f6039da06f2471157348d7f8345ac58e459730195cc5dda8aeaab" }, "downloads": -1, "filename": "twittcher-0.1.05.tar.gz", "has_sig": false, "md5_digest": "af8a51b4202a45e307392815b86267e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5689, "upload_time": "2014-07-26T16:52:57", "url": "https://files.pythonhosted.org/packages/05/a3/3644fd7060c8ce03951daa058cb969ed8002e87329e48e6fecc084ecb842/twittcher-0.1.05.tar.gz" } ], "0.1.06": [ { "comment_text": "", "digests": { "md5": "dc577cd58868c8c7b96908ee18536b88", "sha256": "55d296604696ce327eaba3b860005a3b57594312f172e33abcbb6d7c8f57f6e2" }, "downloads": -1, "filename": "twittcher-0.1.06.tar.gz", "has_sig": false, "md5_digest": "dc577cd58868c8c7b96908ee18536b88", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5702, "upload_time": "2014-07-27T18:12:35", "url": "https://files.pythonhosted.org/packages/da/e5/7d8b933f3d26abeb8ed8063e6a28a206fcc58780d5ba3fb44644942dd2ef/twittcher-0.1.06.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "dc577cd58868c8c7b96908ee18536b88", "sha256": "55d296604696ce327eaba3b860005a3b57594312f172e33abcbb6d7c8f57f6e2" }, "downloads": -1, "filename": "twittcher-0.1.06.tar.gz", "has_sig": false, "md5_digest": "dc577cd58868c8c7b96908ee18536b88", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5702, "upload_time": "2014-07-27T18:12:35", "url": "https://files.pythonhosted.org/packages/da/e5/7d8b933f3d26abeb8ed8063e6a28a206fcc58780d5ba3fb44644942dd2ef/twittcher-0.1.06.tar.gz" } ] }