How to Get a Medium User's Articles

(Using Medium API Python Package)

If you want to fetch all the articles written by a Medium user programmatically, you can do so using the medium-api Python library. This guide will walk you through the process.

Prerequisites

Before diving into the code, make sure you have the medium-api library installed. You can install it using pip:

pip install medium-api

Step-by-Step Guide

Here's a simple Python script to Get and display all articles written by a Medium user.

1. Import Required Libraries

Start by importing the necessary libraries:

2. Get the API Key

You need to get the RAPIDAPI_KEY from your environment variables. This key is essential for authenticating your requests.

3. Create a Medium Object

Initialize the Medium object with your API key:

4. Fetch User's Articles

Create a User object by providing the Medium username of the person whose articles you want to fetch:

5. Print Article Titles

Finally, iterate over the fetched articles and print their titles:

Output

The output will list the titles of all articles written by the specified user. You can view an example of the output here:

With just a few lines of code, you can easily Get and display all articles from a Medium user using the medium-api library. Make sure to replace placeholders with actual values and manage your API keys securely.