|
|
|
@ -106,22 +106,19 @@ class MessageTooLongWarning(NetworkWarning):
|
|
|
|
|
#-------------------------------------------------------------------- |
|
|
|
|
|
|
|
|
|
class NetworkUser(object): |
|
|
|
|
"""Provides an uniform way to access information about users. The |
|
|
|
|
following fields should appear: |
|
|
|
|
|
|
|
|
|
**name** |
|
|
|
|
The name to be displayed as author of the message. *Required* |
|
|
|
|
|
|
|
|
|
**username** |
|
|
|
|
The message author username in the network. *Required* |
|
|
|
|
|
|
|
|
|
**avatar** |
|
|
|
|
URL to the author avatar. *Optional* |
|
|
|
|
""" |
|
|
|
|
"""Provides an uniform way to access information about users.""" |
|
|
|
|
def __init__(self): |
|
|
|
|
self.name = '' |
|
|
|
|
"""The name to be displayed as author of the message. *Required*""" |
|
|
|
|
|
|
|
|
|
self.username = '' |
|
|
|
|
self.avatar = '' |
|
|
|
|
"""The message author username in the network. *Required*""" |
|
|
|
|
|
|
|
|
|
self.avatar = None |
|
|
|
|
"""URL to the author avatar. *Optional*""" |
|
|
|
|
|
|
|
|
|
def __repr__(self): |
|
|
|
|
return "%s (%s)" % (self.name, self.username) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class NetworkData(object): |
|
|
|
@ -228,12 +225,15 @@ class NetworkBase(object):
|
|
|
|
|
if possible. |
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
def is_setup(self): |
|
|
|
|
"""Should return a boolean indicating if the network have all |
|
|
|
|
necessary options set up so it can retrieve information. |
|
|
|
|
:class:`Networks` won't send requests to networks that return False to |
|
|
|
|
this function.""" |
|
|
|
|
return False |
|
|
|
|
def __init__(self): |
|
|
|
|
self.is_setup = False |
|
|
|
|
"""Boolean indication if the network have all necessary options set up |
|
|
|
|
so it can retrieve the messages. :class:`Networks` will not send |
|
|
|
|
requests to networks that return False to this function.""" |
|
|
|
|
|
|
|
|
|
self.user = NetworkUser() |
|
|
|
|
"""A :class:`NetworkUser` with the information about the currently |
|
|
|
|
logged user.""" |
|
|
|
|
|
|
|
|
|
def messages(self): |
|
|
|
|
"""Return a list of :class:`NetworkData` objects for the main |
|
|
|
|