(Using Medium API Python Package)
In this guide, we will walk you through how to retrieve responses or comments on a Medium list using the Medium API in Python. Follow these steps to get started:
Before diving into the code, ensure you have installed the medium-api package. You can install it via pip:
pip install medium-api
First, you need to import the required libraries. The medium-api package provides the necessary tools to interact with Medium's API, and os is used to access environment variables.
Medium API requires an API key for authentication. Store this key as an environment variable named RAPIDAPI_KEY and retrieve it using os.getenv.
With the API key retrieved, create an instance of the Medium class. This object will be used to interact with the Medium API.
Fetch the Medium list using its ID. Replace "38f9e0f9bea6" with the ID of the list you want to access. This returns a MediumList object containing the list details and associated responses.
The MediumList object contains responses or comments. Iterate over these responses and print their content to see the feedback on the list.
To see the output of the script, you can check the following gist: