|
| 1 | +Quickstart |
| 2 | +========== |
| 3 | + |
| 4 | +.. warning:: |
| 5 | + |
| 6 | + This documentation is currently a work in progress and is still rough |
| 7 | + around the edges. Not finding what you are looking for? Please open an |
| 8 | + issue describing your troubles on `python-twitch's github page`_! |
| 9 | + |
| 10 | + |
| 11 | +Installation |
| 12 | +------------ |
| 13 | + |
| 14 | +python-twitch can be installed via:: |
| 15 | + |
| 16 | + pip install python-twitch |
| 17 | + |
| 18 | +For a more unstable version you can directly install from the github |
| 19 | +repository:: |
| 20 | + |
| 21 | + pip install -e git+https://github.com/ingwinlu/python-twitch |
| 22 | + |
| 23 | + |
| 24 | +Dependencies |
| 25 | +------------ |
| 26 | + |
| 27 | +python-twitch supports Python 2.7 and Python 3.3+. It's only dependency is six_ |
| 28 | +which should be automatically be installed when you install python-twitch. |
| 29 | + |
| 30 | + |
| 31 | +Usage |
| 32 | +----- |
| 33 | + |
| 34 | +No additional setup is required, choose which API's you want to use and import |
| 35 | +them. python-twitch also does some logging. For troubleshooting add a handler to |
| 36 | +`twitch.logging.log`. |
| 37 | + |
| 38 | + |
| 39 | +API |
| 40 | ++++ |
| 41 | + |
| 42 | +Choose which ever API's you want to use and import them into your project:: |
| 43 | + |
| 44 | + from twitch.api import v3 |
| 45 | + v3.streams.all(limit=1) |
| 46 | + |
| 47 | + |
| 48 | +Responses |
| 49 | ++++++++++ |
| 50 | + |
| 51 | +All queries executed over python-twitch result in json responses. You can find |
| 52 | +more information on them on the official twitch api documentation. Inofficial |
| 53 | +api's don't have any documentation and might get changed anytime, so don't build |
| 54 | +reliable systems around them and expect the results to change without warning. |
| 55 | + |
| 56 | + |
| 57 | +Logging |
| 58 | ++++++++ |
| 59 | + |
| 60 | +To have access to python-twitchs logging output add a handler to |
| 61 | +twitch.logging.log:: |
| 62 | + |
| 63 | + import logging |
| 64 | + from twitch.logging import log |
| 65 | + |
| 66 | + console_handler = logging.StreamHandler() |
| 67 | + console_handler.setLevel(logging.INFO) |
| 68 | + formatter = logging.Formatter( |
| 69 | + '%(asctime)s - %(name)s - %(levelname)s - %(message)s') |
| 70 | + log.addHandler(console_handler) |
| 71 | + |
| 72 | + |
| 73 | +.. links: |
| 74 | +
|
| 75 | +.. _six: http://pythonhosted.org/six/ |
| 76 | +.. _`python-twitch's github page`: https://github.com/ingwinlu/python-twitch |
0 commit comments