{ "info": { "author": "bibby", "author_email": "bibby@bbby.org", "bugtrack_url": null, "classifiers": [], "description": "itch\n====\n\nA python module for pulling data from the Twitch.tv APIs (kraken, tmi, rechat).\n\nInstall\n-------\n\n::\n\n pip install itch\n\nConfig\n------\n\nStarting in August 2016, the kraken API will `require an application client id `_.\nIf the environment variable ``TWITCH_CLIENT_ID`` is set, itch will use this. There is no default value, but you can use the APIs without one until August;\nafter which you will have to supply your own.\n\n\nModels\n------\n\nitch models wrap their own API endpoints, so most items can be loaded by name using the static ``get`` method, and used as dictionaries.\nIt'd be wise to familiarize yourself with the return values from the `kraken v3 resources `_,\nas most keys (like ``id`` and ``name``) are not explicitly mentioned in the module, but read from json and made into a ``dict``.\n\n::\n\n >>> from itch.models import Channel\n >>> c = Channel.get('itmejp')\n >>> c.followers\n 248650\n >>> c.created_at\n datetime.datetime(2010, 2, 28, 9, 30, 51)\n\n\nAll dates are made into timezone-absent ``datetime`` instances. Nested objects are usually rolled into specialized classes of their own.\n\n\nGenerators\n----------\n\nLists of objects, where API paging is involved is done through generators, allowing you to seamlessly iterate over every item of a collection.\n\n::\n >>> for follow in c.list_following():\n ... print follow.created_at, follow.channel.name\n ...\n 2011-03-04 03:16:19 giantbomb\n 2012-10-17 02:36:20 day9tv\n 2014-01-18 02:14:50 greenspeak\n 2014-01-20 00:50:58 towelliee\n 2014-07-16 05:42:50 camiwins\n 2014-07-28 23:31:00 incontroltv\n ... \n\n\nRechat\n------\n\nVideo objects can reprint chat, if the VOD is still available on twitch.tv .\n\n::\n\n >>> for video in c.past_streams():\n ... for chatline in video.chat_replay():\n ... print \"[%s] %s: %s\" % (video.id, chatline['from'], chatline.message)\n ... break\n ... break\n ...\n [v80935574] mwthecool: Hey everyone!\n\nTMI\n---\n\n``Channel`` method ``get_chatters`` can pull real-time chatters, moderators, and admins.\n\n::\n\n >>> map(str, c.get_chatters().moderators)\n ['crosseye_jack', 'gray_mask', 'itmebot', 'itmejp', 'reginaldxiv', 'strippin', 'tahkai11', 'zodiacviii']\n\n\nCaching\n-------\n\nCurrently, only a file-based cache adapter is ready. Adapters for ``redis`` and ``memcached`` are planned for future releases.\nCache keys are the ``sha256`` of URLs with query parameters, and the values are compressed responses.\nTo add a cache adapter, plug a ``CacheInterface`` compliant subclass directly to the ``itch.TwitchAPI`` before making requests.\n\n::\n\n from cache.filetree import FileTreeCache\n from itch import TwitchAPI\n\n TwitchAPI.set_caching(FileTreeCache())\n\n\nFileTreeCache\n~~~~~~~~~~~~~\n\nThe ``FileTreeCache`` accepts the optional environment variable ``TWITCH_CACHE_TEMP`` to set the cache path on disk.\n\n\nRedisCache\n~~~~~~~~~~\n\n``rcache.RedisCache`` requires the pip module ``redis``, which is not installed by itch. Starting with itch 0.3, the required modules can be installed by pip installing ``itch[cache]`` or ``itch[complete]``.\nThis cache makes use the following environment variables:\n\n::\n\n REDIS_HOST (default: localhost)\n REDIS_PORT (default: 6379)\n REDIS_PASSWORD (default: '')\n REDIS_DB (default: 1)\n\n\nMemcacheCache\n~~~~~~~~~~~~~\n\n``mcache.MemcacheCache`` requires the pip module ``python-memcached``, which is not installed by itch.\nThis cache makes use the ``MEMCACHE_SERVERS`` environment variable, which should be a comma separated list\nof ``:`` items. The default value is ``127.0.0.1:11211``.\n\nStarting with itch 0.3, the required modules can be installed by pip installing ``itch[cache]`` or ``itch[complete]``.\n\n\nCLI\n---\n\nThe command line tool prints tab-separated reports that are suitable for the plotter.\n\n::\n\n $ itch -h\n usage: itch [-h] [-d {asc,desc}] [-l LIMIT] [-c {file,redis,memcache}]\n [{chatlog,created,chatters,num_following,num_followers,followers,following,loots_streams}]\n [channel]\n\n Twitch.tv APIs module\n\n positional arguments:\n {chatlog,created,chatters,num_following,num_followers,followers,following,loots_streams}\n command\n channel channel\n\n optional arguments:\n -h, --help show this help message and exit\n -d {asc,desc}, --direction {asc,desc}\n sorting direction\n -l LIMIT, --limit LIMIT\n number of items to pull\n -c {file,redis,memcache}, --cache {file,redis,memcache}\n cache type. See README for required env vars\nPlotter\n-------\n\nThe cli tool ``itch-plot`` renders charts with data extracted from the ``itch`` CLI or other custom tools. The\nmodule requires the pip modules ``matplotlib`` and ``scipy``, which is not installed by itch (because ``numpy``).\n\nStarting with itch 0.3, the required modules can be installed by pip installing ``itch[plot]`` or ``itch[complete]``.\n\n::\n\n $ itch-plot -h\n usage: itch-plot [-h] [-x XFIELD] [-y YFIELD] [-m XMIN] [-M XMAX] [-n YMIN]\n [-N YMAX] [-d DELIMITER] [-r] [-s] [-S STREAMS]\n [-t {scatter,line,mixed}] [-l LABEL] [-T TITLE] [-D]\n [infile] [outfile]\n\n plot generator\n\n positional arguments:\n infile InFile\n outfile OutFile\n\n optional arguments:\n -h, --help show this help message and exit\n -x XFIELD X axis field name\n -y YFIELD Y axis field name\n -m XMIN, --xmin XMIN min x value\n -M XMAX, --xmax XMAX maz x value\n -n YMIN, --ymin YMIN yin x value\n -N YMAX, --ymax YMAX max y value\n -d DELIMITER, --delimiter DELIMITER\n field delimiter\n -r, --record print whole record (for saving subsets)\n -s, --silent skip printouts\n -S STREAMS, --streams STREAMS\n streams json\n -t {scatter,line,mixed}, --type {scatter,line,mixed}\n graph type\n -l LABEL, --label LABEL\n x label\n -T TITLE, --title TITLE\n chart title\n -D, --density Density coloration; much slower renders\n\n\nExample data pull and chart render:\n\n::\n\n # dump the last 1K followers to a file\n itch -l 1000 -c file followers burkeblack > followers.csv\n\n # dump the last 20 streams to a file\n itch -l 20 -c file loots_streams burkeblack > streams.csv\n\n # plot the followers while overlaying the streams,\n # trimming the viewport and setting a title.\n itch-plot -sS streams.csv -m '2016-07-25' -M '2016-08-01' \\\n -T 'BurkeBlack - last 1K' followers.csv plot.png\n\nHere is the `resulting graph `_\n\n\nTodo\n----\n\nFocused on my own use-cases, kraken v3 resources are not completely covered.\nThis initial release of itch does not currently work with subscribers or subscriptions, games, or top stream lists.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bibby/itch", "keywords": "twitch", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "itch", "package_url": "https://pypi.org/project/itch/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/itch/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/bibby/itch" }, "release_url": "https://pypi.org/project/itch/0.3.0/", "requires_dist": null, "requires_python": null, "summary": "Twitch APIs client", "version": "0.3.0" }, "last_serial": 2283396, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "99dd039150da2ce9becaf257d9185ab1", "sha256": "5b7dd13d7ce92c457e5e96c9d9ec0c6341bc243696b9b339b0ab1ea30d3ff5e0" }, "downloads": -1, "filename": "itch-0.1.0-py2-none-any.whl", "has_sig": false, "md5_digest": "99dd039150da2ce9becaf257d9185ab1", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 10073, "upload_time": "2016-07-31T08:00:08", "url": "https://files.pythonhosted.org/packages/ae/44/0f1cda9e5fca6e59002b31a0815ce19a1b1489a83f15ae02410ee9d5d290/itch-0.1.0-py2-none-any.whl" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "aab45821dbeebdbcca03d8772a6a59eb", "sha256": "db95615ee8de5286a0d2b15e7d1c218739cf2a3380765787a1b03c783d330b7d" }, "downloads": -1, "filename": "itch-0.2.0-py2-none-any.whl", "has_sig": false, "md5_digest": "aab45821dbeebdbcca03d8772a6a59eb", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 17544, "upload_time": "2016-08-01T07:42:00", "url": "https://files.pythonhosted.org/packages/a1/e3/3eb6ec495c3142523920d409b0182fa0838b85c1ee8fa3b8e6862d9369ee/itch-0.2.0-py2-none-any.whl" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "0c3aff9e2374d2782653fc3959e32896", "sha256": "22f95c8728f62fe8504ff7b251fda3f3a478623e99b3282356e17cec4a05c778" }, "downloads": -1, "filename": "itch-0.2.1-py2-none-any.whl", "has_sig": false, "md5_digest": "0c3aff9e2374d2782653fc3959e32896", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 17633, "upload_time": "2016-08-03T03:54:26", "url": "https://files.pythonhosted.org/packages/53/9a/10623bde3777b443a8966b25f8c1ccc082aca080fad42bf5bb793ff8252b/itch-0.2.1-py2-none-any.whl" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "07e6329c3cbe64baf5829f69534709ae", "sha256": "cc96f5bf6c83f3710c43debce580fc296e1ea1198727c661bb17c7be6b96fb0b" }, "downloads": -1, "filename": "itch-0.3.0-py2-none-any.whl", "has_sig": false, "md5_digest": "07e6329c3cbe64baf5829f69534709ae", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 19166, "upload_time": "2016-08-16T03:59:32", "url": "https://files.pythonhosted.org/packages/85/f1/43fb142568fcead2b6916eae7466f596720b1587cb885d5ba6161e42bfde/itch-0.3.0-py2-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "07e6329c3cbe64baf5829f69534709ae", "sha256": "cc96f5bf6c83f3710c43debce580fc296e1ea1198727c661bb17c7be6b96fb0b" }, "downloads": -1, "filename": "itch-0.3.0-py2-none-any.whl", "has_sig": false, "md5_digest": "07e6329c3cbe64baf5829f69534709ae", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 19166, "upload_time": "2016-08-16T03:59:32", "url": "https://files.pythonhosted.org/packages/85/f1/43fb142568fcead2b6916eae7466f596720b1587cb885d5ba6161e42bfde/itch-0.3.0-py2-none-any.whl" } ] }