|
|
|
@ -107,31 +107,36 @@ class MessageTooLongWarning(NetworkWarning):
|
|
|
|
|
|
|
|
|
|
class NetworkData(object): |
|
|
|
|
"""Provides an uniform way to access information about posts. The |
|
|
|
|
following fields should appear: |
|
|
|
|
following fields should appear[*]_ [*]_: |
|
|
|
|
|
|
|
|
|
**id** |
|
|
|
|
The message identification. |
|
|
|
|
The message identification. *Optional* |
|
|
|
|
|
|
|
|
|
**name** |
|
|
|
|
The name to be displayed as author of the message. |
|
|
|
|
The name to be displayed as author of the message. *Required* |
|
|
|
|
|
|
|
|
|
**username** |
|
|
|
|
The message author username in the network. |
|
|
|
|
The message author username in the network. *Required* |
|
|
|
|
|
|
|
|
|
**avatar** |
|
|
|
|
URL to the author avatar. |
|
|
|
|
URL to the author avatar. *Optional* |
|
|
|
|
|
|
|
|
|
**message** |
|
|
|
|
The message. |
|
|
|
|
The message. *Required* |
|
|
|
|
|
|
|
|
|
**message_time** |
|
|
|
|
Message timestamp (as a datetime object). Defaults to None. |
|
|
|
|
Message timestamp (as a datetime object). Defaults to None. *Optional* |
|
|
|
|
|
|
|
|
|
**favourite** |
|
|
|
|
Boolean indicating if the message was marked as "favourite" or not. |
|
|
|
|
*Optional* |
|
|
|
|
|
|
|
|
|
**parent** |
|
|
|
|
The parent of this message, in case of a reply. |
|
|
|
|
The parent of this message, in case of a reply. *Optional* |
|
|
|
|
|
|
|
|
|
**parent_owner** |
|
|
|
|
Username of the owner of the parent message (in other words, "in reply |
|
|
|
|
to".) *Optional* |
|
|
|
|
|
|
|
|
|
**reposted_by** |
|
|
|
|
Username friend of the current user that reposted that message. Some |
|
|
|
@ -139,12 +144,17 @@ class NetworkData(object):
|
|
|
|
|
in this case, returns the original message with the original user |
|
|
|
|
in a "retweeted_status" structure.) In this case, the network layer |
|
|
|
|
will must return the original user in *name*, *username* and *avatar*, |
|
|
|
|
while the friend username will be moved to *reposted_by*. |
|
|
|
|
while the friend username will be moved to *reposted_by*. *Optional* |
|
|
|
|
|
|
|
|
|
**network** |
|
|
|
|
The network id source of the message. Network classes don't need to |
|
|
|
|
worry about this field themselves; :class:`Networks` will set it when |
|
|
|
|
merging information from all networks. |
|
|
|
|
merging information from all networks. *Networks should **NEVER** fill |
|
|
|
|
this field* |
|
|
|
|
|
|
|
|
|
.. [*] Not all fields need to be filled if that would require more than |
|
|
|
|
one network call. |
|
|
|
|
.. [*] Most networks need to be ready for some fields to not be filled. |
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
def __init__(self): |
|
|
|
@ -156,6 +166,7 @@ class NetworkData(object):
|
|
|
|
|
self.message_time = None |
|
|
|
|
self.favourite = False |
|
|
|
|
self.parent = '' |
|
|
|
|
self.parent_owner = '' |
|
|
|
|
self.reposted_by = '' |
|
|
|
|
self.network = '' |
|
|
|
|
|
|
|
|
|