[backport][2.9][PR #70446] Refactor Python API examples and docs #70851
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY
Backport of 8d97c8c + partial backport of 4816bb4. It should be merged on top of PR #70842
This change is a follow-up for #70445. When I looked at #69758, I noticed that
there's two places with almost the same example in the repo.
It'd be way easier to maintain just one piece of code and include it in other
place dynamically.
It's basically a merge of two almost identical examples originally
stored as a Python module + its copy-paste in the docs.
The patch also changes the docs RST file to include contents of the example
file instead of holding a copy of similar code.
ISSUE TYPE
COMPONENT NAME
docs/docsite/rst/dev_guide/developing_api.rst
examples/scripts/uptime.py
ADDITIONAL INFORMATION
N/A