|
|
@ -107,31 +107,36 @@ class MessageTooLongWarning(NetworkWarning): |
|
|
|
|
|
|
|
|
|
|
|
class NetworkData(object): |
|
|
|
class NetworkData(object): |
|
|
|
"""Provides an uniform way to access information about posts. The |
|
|
|
"""Provides an uniform way to access information about posts. The |
|
|
|
following fields should appear: |
|
|
|
following fields should appear[*]_ [*]_: |
|
|
|
|
|
|
|
|
|
|
|
**id** |
|
|
|
**id** |
|
|
|
The message identification. |
|
|
|
The message identification. *Optional* |
|
|
|
|
|
|
|
|
|
|
|
**name** |
|
|
|
**name** |
|
|
|
The name to be displayed as author of the message. |
|
|
|
The name to be displayed as author of the message. *Required* |
|
|
|
|
|
|
|
|
|
|
|
**username** |
|
|
|
**username** |
|
|
|
The message author username in the network. |
|
|
|
The message author username in the network. *Required* |
|
|
|
|
|
|
|
|
|
|
|
**avatar** |
|
|
|
**avatar** |
|
|
|
URL to the author avatar. |
|
|
|
URL to the author avatar. *Optional* |
|
|
|
|
|
|
|
|
|
|
|
**message** |
|
|
|
**message** |
|
|
|
The message. |
|
|
|
The message. *Required* |
|
|
|
|
|
|
|
|
|
|
|
**message_time** |
|
|
|
**message_time** |
|
|
|
Message timestamp (as a datetime object). Defaults to None. |
|
|
|
Message timestamp (as a datetime object). Defaults to None. *Optional* |
|
|
|
|
|
|
|
|
|
|
|
**favourite** |
|
|
|
**favourite** |
|
|
|
Boolean indicating if the message was marked as "favourite" or not. |
|
|
|
Boolean indicating if the message was marked as "favourite" or not. |
|
|
|
|
|
|
|
*Optional* |
|
|
|
|
|
|
|
|
|
|
|
**parent** |
|
|
|
**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** |
|
|
|
**reposted_by** |
|
|
|
Username friend of the current user that reposted that message. Some |
|
|
|
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 this case, returns the original message with the original user |
|
|
|
in a "retweeted_status" structure.) In this case, the network layer |
|
|
|
in a "retweeted_status" structure.) In this case, the network layer |
|
|
|
will must return the original user in *name*, *username* and *avatar*, |
|
|
|
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** |
|
|
|
**network** |
|
|
|
The network id source of the message. Network classes don't need to |
|
|
|
The network id source of the message. Network classes don't need to |
|
|
|
worry about this field themselves; :class:`Networks` will set it when |
|
|
|
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): |
|
|
|
def __init__(self): |
|
|
@ -156,6 +166,7 @@ class NetworkData(object): |
|
|
|
self.message_time = None |
|
|
|
self.message_time = None |
|
|
|
self.favourite = False |
|
|
|
self.favourite = False |
|
|
|
self.parent = '' |
|
|
|
self.parent = '' |
|
|
|
|
|
|
|
self.parent_owner = '' |
|
|
|
self.reposted_by = '' |
|
|
|
self.reposted_by = '' |
|
|
|
self.network = '' |
|
|
|
self.network = '' |
|
|
|
|
|
|
|
|
|
|
|