Updating a lot of docstrings, EndpointMixin replaces api_table dict

[ci skip]
This commit is contained in:
Mike Helmick 2013-06-06 13:40:39 -04:00
parent 9c6fe0d6b8
commit ff7e3fab94
5 changed files with 858 additions and 450 deletions

View file

@ -1,6 +1,5 @@
from .. import __version__
from ..compat import json, is_py3
from ..exceptions import TwythonStreamError
from .types import TwythonStreamerTypes
import requests
@ -112,7 +111,8 @@ class TwythonStreamer(object):
See https://dev.twitter.com/docs/streaming-apis/messages for messages
sent along in stream responses.
:param data: dict of data recieved from the stream
:param data: data recieved from the stream
:type data: dict
"""
if 'delete' in data:
@ -129,7 +129,10 @@ class TwythonStreamer(object):
want it handled.
:param status_code: Non-200 status code sent from stream
:type status_code: int
:param data: Error message sent from stream
:type data: dict
"""
return
@ -141,8 +144,8 @@ class TwythonStreamer(object):
Twitter docs for deletion notices: http://spen.se/8qujd
:param data: dict of data from the 'delete' key recieved from
the stream
:param data: data from the 'delete' key recieved from the stream
:type data: dict
"""
return
@ -154,8 +157,8 @@ class TwythonStreamer(object):
Twitter docs for limit notices: http://spen.se/hzt0b
:param data: dict of data from the 'limit' key recieved from
the stream
:param data: data from the 'limit' key recieved from the stream
:type data: dict
"""
return
@ -167,13 +170,15 @@ class TwythonStreamer(object):
Twitter docs for disconnect notices: http://spen.se/xb6mm
:param data: dict of data from the 'disconnect' key recieved from
the stream
:param data: data from the 'disconnect' key recieved from the stream
:type data: dict
"""
return
def on_timeout(self):
""" Called when the request has timed out """
return
def disconnect(self):
"""Used to disconnect the streaming client manually"""
self.connected = False

View file

@ -1,9 +1,20 @@
# -*- coding: utf-8 -*-
"""
twython.streaming.types
~~~~~~~~~~~~~~~~~~~~~~~
This module contains classes and methods for :class:`TwythonStreamer` to mak
"""
class TwythonStreamerTypes(object):
"""Class for different stream endpoints
Not all streaming endpoints have nested endpoints.
User Streams and Site Streams are single streams with no nested endpoints
Status Streams include filter, sample and firehose endpoints
"""
def __init__(self, streamer):
self.streamer = streamer
@ -36,6 +47,7 @@ class TwythonStreamerTypesStatuses(object):
Available so TwythonStreamer.statuses.filter() is available.
Just a bit cleaner than TwythonStreamer.statuses_filter(),
statuses_sample(), etc. all being single methods in TwythonStreamer
"""
def __init__(self, streamer):
self.streamer = streamer
@ -43,6 +55,8 @@ class TwythonStreamerTypesStatuses(object):
def filter(self, **params):
"""Stream statuses/filter
:param \*\*params: Paramters to send with your stream request
Accepted params found at:
https://dev.twitter.com/docs/api/1.1/post/statuses/filter
"""
@ -53,6 +67,8 @@ class TwythonStreamerTypesStatuses(object):
def sample(self, **params):
"""Stream statuses/sample
:param \*\*params: Paramters to send with your stream request
Accepted params found at:
https://dev.twitter.com/docs/api/1.1/get/statuses/sample
"""
@ -63,6 +79,8 @@ class TwythonStreamerTypesStatuses(object):
def firehose(self, **params):
"""Stream statuses/firehose
:param \*\*params: Paramters to send with your stream request
Accepted params found at:
https://dev.twitter.com/docs/api/1.1/get/statuses/firehose
"""