Skip to main content

Define the environment

First, we’ll define our environment:
app.py

Write scraping logic

Now, we’ll write logic to scrape the headlines from The New York Times. In order to run this on Beam, we add an @app.run() decorator to the function:
scraper.py

Running the scraper

Now, we’re ready to run our code using Beam. In your terminal, run:
You should see the headlines and the detected sentiment of each: