# Import libraries
import os
from medium_api import Medium

# Get RAPIDAPI_KEY from the environment
api_key = os.getenv('RAPIDAPI_KEY')

# Create a `Medium` Object
medium = Medium(api_key)

# Create a "TopFeeds" Object with tag="data-science" and mode="new"
topfeeds = medium.topfeeds(
                tag = "data-science", 
                mode = "new"
            )

# Fetch all the articles information
topfeeds.fetch_articles()

# Iterate over topfeeds articles and print their title
for article in topfeeds.articles:
    print(article.title)