(Using Medium API Python Package)
If you're looking to find out who has clapped for your Medium article, you can easily do this using the Medium API and a bit of Python code. Here's a step-by-step guide on how to achieve this.
Before you start, ensure you have the medium-api library installed. You can do this by running:
pip install medium-api
Here's a Python script that demonstrates how to get a list of users who have clapped for a Medium article.
This part of the code imports the necessary libraries. os is used to access environment variables, and Medium is a class from the medium-api library that allows interaction with Medium’s API.
Here, we retrieve the Medium API key from an environment variable named RAPIDAPI_KEY. Make sure this key is set in your environment variables before running the script.
We create an instance of the Medium class using the API key we obtained. This object will be used to interact with the Medium API.
Replace "67fa62fc1971" with the ID of the Medium article you want to analyze. The fetch_fans() method retrieves the list of users who have clapped for the article.
Finally, this loop goes through the list of fans and prints their full names and usernames.
By following these steps, you can easily retrieve and display the fans of any Medium article using Python. Just ensure your API key is correctly set and the article ID is accurate. Happy coding!