From 62c52c3d355b7d0cccdd34c3458544ac560db12e Mon Sep 17 00:00:00 2001
From: Moul <moul@moul.re>
Date: Thu, 6 May 2021 23:16:57 +0200
Subject: [PATCH] [doc] #160: Document examples usage from Python interpreter

---
 README.md | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md
index 3e70265d..1b3be0e1 100644
--- a/README.md
+++ b/README.md
@@ -53,8 +53,29 @@ pip3 install duniterpy --user
 ## Documentation
 [Online official automaticaly generated documentation](https://clients.duniter.io/python/duniterpy/index.html)
 
+## Examples
 The [examples folder](https://git.duniter.org/clients/python/duniterpy/tree/master/examples) contains scripts to help you!
 
+- Have a look at the `examples` folder
+- Run examples from parent folder directly
+```bash
+poetry run python examples/request_data.py
+```
+
+Or from Python interpreter:
+```bash
+poetry run python
+>>> import examples
+>>> help(examples)
+>>> examples.create_public_key()
+```
+
+`request_data_async` example requires to be run with `asyncio`:
+```bash
+>>> import examples, asyncio
+>>> asyncio.get_event_loop().run_until_complete(examples.request_data_async())
+```
+
 ### How to generate and read locally the autodoc
 
 - Install Sphinx, included into the development dependencies:
@@ -78,12 +99,6 @@ poetry run make docs
 poetry install --no-dev
 ```
 
-* Have a look at the examples folder
-* Run examples from parent folder
-```bash
-poetry run python examples/request_data.py
-```
-
 * Before submitting a merge requests, please check the static typing and tests.
 
 * Install dev dependencies
-- 
GitLab