script/lib/iri_tweet/iri_tweet/__init__.py
author Raphael Velt <raph.velt@gmail.com>
Fri, 07 Jun 2013 18:14:58 +0200
changeset 923 fc2887823d3d
parent 883 8ae3d91ea4ae
child 1507 1e7aa7dc444b
permissions -rw-r--r--
Added tag V02.29 for changeset 6f6e0d348a67

"""Simple model end tools to record tweets"""

VERSION = (0, 82, 0, "final", 0)

VERSION_STR = unicode(".".join(map(lambda i:"%02d" % (i,), VERSION[:2])))


def get_version():
    version = '%s.%s' % (VERSION[0], VERSION[1])
    if VERSION[2]:
        version = '%s.%s' % (version, VERSION[2])
    if VERSION[3:] == ('alpha', 0):
        version = '%s pre-alpha' % version
    else:
        if VERSION[3] != 'final':
            version = '%s %s %s' % (version, VERSION[3], VERSION[4])
    return version

__version__ = get_version()
__author__ = "Yves-Marie Haussonne"
__contact__ = "ymh.work@gmail.com"
__homepage__ = ""
__docformat__ = "restructuredtext"


"""
 .. data:: USER_AGENT

     The default user agent string for stream objects
"""

USER_AGENT = "IRITweet %s" % __version__


class IRITweetError(Exception):
    """Base class for all IRITweet errors"""
    pass


class AuthenticationError(IRITweetError):
    """Exception raised if the username/password is not accepted"""
    pass


class ConnectionError(IRITweetError):
    """Raised when there are network problems. This means when there are
    dns errors, network errors, twitter issues"""

    def __init__(self, reason, details=None):
        self.reason = reason
        self.details = details

    def __str__(self):
        return '<ConnectionError %s>' % self.reason