Skip to content

Commit

Permalink
Docs: Add requests example (Closes #45)
Browse files Browse the repository at this point in the history
  • Loading branch information
thp committed Jul 7, 2023
1 parent 5ca5513 commit d419ed7
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ either as seconds or as `RFC 2326`_ Normal Play Time (NPT).
Example
=======

Using the built-in ``urllib.request`` module from Python 3:

.. code-block:: python
import podcastparser
Expand All @@ -57,6 +59,27 @@ Example
.. TODO: Show example dict for a parsed feed with all fields
Using `Requests`_:

.. code-block:: python
import podcastparser
import requests
url = 'https://example.net/podcast.atom'
with requests.get(url, stream=True) as response:
response.raw.decode_content = True
parsed = podcastparser.parse(url, response.raw)
# parsed is a dict
import pprint
pprint.pprint(parsed)
.. _Requests: https://requests.readthedocs.io


Supported XML Elements and Attributes
=====================================

Expand Down

0 comments on commit d419ed7

Please sign in to comment.