networkbase – Base classes for all networks
The networkbase module defines the base classes for all networks.
NetworkBase – Base class for all networks
-
class networkbase.NetworkBase
Base class for all networks.
-
AUTH
List of fields the interface must request to the user in order to
retrieve information from the network. It’s a list of dictionaries,
containing:
- name: Name of the option, used in ConfigOpt (for the name in the
config file and to access it through the options variable);
- flags: The list of command line options for this option (as in
OptParse);
- prompt: The prompt to be used by interfaces when requesting the
variable;
- help: Description for the value; it’s used by ConfigOpt to show the
description of the paramater in the command line options and can be used
by interfaces to show tooltips about the field;
- type: The type of the option; valid values are:
- ‘str’: A string;
- ‘passwd’: Password; string, but interfaces should hide the information
if possible.
-
NAMESPACE
- Namespace of the network, used to identify options.
-
available_requests()
- Return the number of requests the user can request before being
capped. If such limitation doesn’t exist for the network, a negative
number should be returned.
-
can_delete(message)
- Return True if the message can be deleted; False otherwise.
-
can_favourite(message)
- Return True if the message can be favourited/unfavourited; False
otherwise.
-
can_reply(message)
- Return True if the message can be replied; False otherwise.
-
can_repost(message)
- Return True if the message can be resposted; False otherwise.
-
delete_message(message)
- Delete an update. Must return True if the message was deleted or
False if not. message can be either an id or a NetworkData
object with the information about the message to be deleted.
-
favourite(message)
- Toggle the favourite status of a message. message must be a valid
NetworkData object. Returns True if the request was
successful or False otherwise.
-
is_setup()
- Should return a boolean indicating if the network have all
necessary options set up so it can retrieve information.
Networks won’t send requests to networks that return False to
this function.
-
link(message)
- Returns a link (as string) to the message in the network site. If
the network doesn’t provide a link directly to the message, None shall
be returned. message is a NetworkData object.
-
message(message_id)
- Return a single NetworkData object for a specified
message.
-
messages()
- Return a list of NetworkData objects for the main
“timeline” (the default list presented to the user.)
-
replies()
- Return a list of NetworkData objects for the replies for
the user messages.
-
reply_prefix(message)
- Return the prefix to be used in case the user requests a reply for
that message. message must be a NetworkData object. Returns
a string.
-
repost(message)
- Repost a message in your current timeline. message must be a
valid NetworkData object. Must return the id of the new
message.
-
update(status, reply_to=None)
- Update the user status. status should be the string with the
status update; reply_to should be used in case the message is a
reply to another message, it could be a simple id or the
NetworkData object of the original data. Must return the id
for the new status.