Skip to content

Commit

Permalink
add docs for attach_methods (#2465)
Browse files Browse the repository at this point in the history
  • Loading branch information
wolovim authored May 11, 2022
1 parent a42d8c8 commit 874ae5c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/web3.main.rst
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,26 @@ These internal modules inherit from the ``web3.module.Module`` class which give
web3.py library.


Custom Methods
~~~~~~~~~~~~~~

You may add or overwrite methods within any module using the ``attach_methods`` function.
To create a property instead, set ``is_property`` to ``True``.

.. code-block:: python
>>> w3.eth.attach_methods({
... 'example_method': Method(
... 'eth_example',
... mungers=[...],
... request_formatters=[...],
... result_formatters=[...],
... is_property=False,
... ),
... })
>>> w3.eth.example_method()
External Modules
~~~~~~~~~~~~~~~~

Expand Down

0 comments on commit 874ae5c

Please sign in to comment.