teatime.plugins package¶
Subpackages¶
- teatime.plugins.eth1 package
- Submodules
- teatime.plugins.eth1.account_creation module
- teatime.plugins.eth1.account_import module
- teatime.plugins.eth1.gas_limits module
- teatime.plugins.eth1.information_leaks module
- teatime.plugins.eth1.manipulation module
- teatime.plugins.eth1.mining module
- teatime.plugins.eth1.network module
- teatime.plugins.eth1.open_accounts module
- teatime.plugins.eth1.rpc module
- teatime.plugins.eth1.sha3 module
- teatime.plugins.eth1.sync module
- teatime.plugins.eth1.tx_limits module
- teatime.plugins.eth1.txpool module
- teatime.plugins.eth1.upgrade module
- teatime.plugins.eth1.version module
- teatime.plugins.eth1.websocket module
- Module contents
- teatime.plugins.ipfs package
- Submodules
- teatime.plugins.ipfs.add module
- teatime.plugins.ipfs.commands module
- teatime.plugins.ipfs.files module
- teatime.plugins.ipfs.keys module
- teatime.plugins.ipfs.logs module
- teatime.plugins.ipfs.p2p module
- teatime.plugins.ipfs.pins module
- teatime.plugins.ipfs.shutdown module
- teatime.plugins.ipfs.version module
- teatime.plugins.ipfs.webui module
- Module contents
Submodules¶
teatime.plugins.base module¶
This module holds the base plugin class and exception.
-
class
teatime.plugins.base.
BasePlugin
[source]¶ Bases:
abc.ABC
The base plugin class.
-
INTRUSIVE
= True¶
-
run
(context: teatime.plugins.context.Context)[source]¶ The plugin’s entrypoint as invoked by the scanner.
This method will call the plugin’s
_check
method, which should be overridden by concrete JSONRPCPlugin instances. It will catch anyPluginException
and skip the execution. In any case, at the end of the check run, the plugin name is added as a meta field to denote that it has been executed.Parameters: context – The context object containing report-related information
-
-
class
teatime.plugins.base.
IPFSRPCPlugin
[source]¶ Bases:
teatime.plugins.base.BasePlugin
,abc.ABC
-
static
get_rpc_json
(target: str, route: str = '', params: Union[dict, Sequence[tuple]] = None, headers: Optional[dict] = None, files: Optional[dict] = None, raw: bool = False, timeout: int = 3, stream_limit: int = None)[source]¶ Send a request to the IPFS HTTP API.
Parameters: - target – The target to send the request to
- route – The URL to send the API request to
- params – A dict of URL parameters to add
- headers – Optional headers to attach
- files – A dictionary of files to upload
- raw – If true, the result will not interpreted as JSON
- timeout – Number of seconds to wait until timing out
- stream_limit – Maximum number of lines to read
Returns:
-
static
-
class
teatime.plugins.base.
JSONRPCPlugin
[source]¶ Bases:
teatime.plugins.base.BasePlugin
,abc.ABC
A base plugin for JSON-RPC APIs.
-
static
get_rpc_int
(target, method, params: List[str] = None, idx: int = 1) → int[source]¶ Attempt to make an RPC call and decode the result as an integer.
Parameters: - target – The RPC target URL
- method – The RPC method
- params – Additional RPC method params (optional)
- idx – RPC call index (optional)
Returns: The payload result as integer
Raises: PluginException – If connection or payload-related errors occur
-
static
get_rpc_json
(target: str, method: str, params: List[Union[str, int]] = None, idx: int = 0)[source]¶ Execute an RPC call against a given target.
The current timeout for the RPC request is three seconds. Any
PluginException
instances raised, contain the reason in the message string, e.g. if a connection failure occurred, the response status code was not 200, an error field is present, or if the result field is left empty.Parameters: - target – The target URI to send the request to
- method – The RPC method to use
- params – Additional parameters for the method (optional)
- idx – The RPC call’s ID (optional)
Returns: The response payload’s “result” field
Raises: PluginException – If the request faied or the response is inconsistent
-
static
teatime.plugins.context module¶
This module contains the context that is passed to plugins.
Module contents¶
The package holding all Teatime plugins.