(Using Medium API Python Package)
If you're interested in fetching a list of Medium publications where a specific user is either an editor or a creator, this guide will walk you through how to achieve that using the Medium API in Python.
Before you start, make sure you have the medium-api package installed. You can install it using pip:
pip install medium-api
To begin with, you'll need to import the necessary libraries. In this case, we'll use os for handling environment variables and Medium from the medium_api package.
You need to get the API key from your environment variables. This key is essential for authenticating your requests to the Medium API.
Ensure that you have set the RAPIDAPI_KEY in your environment. You can do this by adding it to your system's environment variables or a .env file.
With the API key at hand, you can now create an instance of the Medium class. This object will be used to interact with the Medium API.
Next, you need to create a User object. This is where you specify the username of the Medium user whose publications you want to fetch. Replace "zulie" with the username you're interested in.
Now that you have the User object, you can fetch information about the publications the user is associated with. This includes publications where the user is an admin or a contributing writer. Here's how you can fetch and print this information:
In this guide, you learned how to use the Medium API to fetch and display the list of publications associated with a specific Medium user. By following these steps, you can easily retrieve publication details and manage your Medium content more effectively.