script/lib/tweetstream/tweetstream/__init__.py
author Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
Mon, 20 Feb 2012 01:35:15 +0100
changeset 527 80e5b9543cac
parent 207 621fa6caec0c
parent 14 10e7a0c7c64f
child 529 99215db3da25
permissions -rw-r--r--
Merge with 9d7218514a08006f925f138df88d770b29fae4cc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14
10e7a0c7c64f upgrade tweet stream to 1.1.1
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 13
diff changeset
     1
"""Simple access to Twitter's streaming API"""
10e7a0c7c64f upgrade tweet stream to 1.1.1
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 13
diff changeset
     2
10e7a0c7c64f upgrade tweet stream to 1.1.1
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 13
diff changeset
     3
VERSION = (1, 1, 1)
10e7a0c7c64f upgrade tweet stream to 1.1.1
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 13
diff changeset
     4
__version__ = ".".join(map(str, VERSION[0:3])) + "".join(VERSION[3:])
10e7a0c7c64f upgrade tweet stream to 1.1.1
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 13
diff changeset
     5
__author__ = "Rune Halvorsen"
10e7a0c7c64f upgrade tweet stream to 1.1.1
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 13
diff changeset
     6
__contact__ = "runefh@gmail.com"
12
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
     7
__homepage__ = "http://bitbucket.org/runeh/tweetstream/"
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
     8
__docformat__ = "restructuredtext"
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
     9
14
10e7a0c7c64f upgrade tweet stream to 1.1.1
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 13
diff changeset
    10
# -eof meta-
10e7a0c7c64f upgrade tweet stream to 1.1.1
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 13
diff changeset
    11
12
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    12
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    13
"""
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    14
 .. data:: USER_AGENT
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    15
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    16
     The default user agent string for stream objects
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    17
"""
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    18
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    19
USER_AGENT = "TweetStream %s" % __version__
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    20
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    21
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    22
class TweetStreamError(Exception):
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    23
    """Base class for all tweetstream errors"""
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    24
    pass
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    25
13
79b6e132e3d7 upgrade tweetstream to 1.0.0
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 12
diff changeset
    26
12
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    27
class AuthenticationError(TweetStreamError):
13
79b6e132e3d7 upgrade tweetstream to 1.0.0
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 12
diff changeset
    28
    """Exception raised if the username/password is not accepted"""
12
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    29
    pass
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    30
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    31
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    32
class ConnectionError(TweetStreamError):
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    33
    """Raised when there are network problems. This means when there are
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    34
    dns errors, network errors, twitter issues"""
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    35
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    36
    def __init__(self, reason, details=None):
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    37
        self.reason = reason
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    38
        self.details = details
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    39
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    40
    def __str__(self):
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    41
        return '<ConnectionError %s>' % self.reason
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    42
4daf47fcf792 move lib and prepare tweetstream for modification
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    43
14
10e7a0c7c64f upgrade tweet stream to 1.1.1
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 13
diff changeset
    44
from .streamclasses import SampleStream, FilterStream
10e7a0c7c64f upgrade tweet stream to 1.1.1
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents: 13
diff changeset
    45
from .deprecated import FollowStream, TrackStream, LocationStream, TweetStream, ReconnectingTweetStream