Skip to content

Commit

Permalink
Add example for reading text from a file
Browse files Browse the repository at this point in the history
Is this good enough to address PyGithub#576 ?
  • Loading branch information
c-martinez committed Oct 22, 2020
1 parent 3ec145f commit 2d536e8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions doc/examples/Repository.rst
Expand Up @@ -107,6 +107,20 @@ Get a specific content file
...
ContentFile(path="README.md")
Read a specific content file
---------------------------

.. code-block:: python
>>> repo = g.get_repo("PyGithub/PyGithub")
>>> contents = repo.get_contents("README.md")
>>> text = str(contents.decoded_content, 'utf-8')
>>> print(text)
# PyGitHub
[![PyPI](https://img.shields.io/pypi/v/PyGithub.svg)](https://pypi.python.org/pypi/PyGithub)
...
Create a new file in the repository
-----------------------------------

Expand Down

0 comments on commit 2d536e8

Please sign in to comment.