Theme-Based Poem Generator is a Python script that fetches poems from the PoetryDB API based on a user-provided theme or keyword.
Simply type a word or concept (e.g., love, rain, night) and get a beautifully formatted poem in your terminal.
- 🔎 Fetch poems by keyword or theme.
- 🎲 Randomly selects a poem if multiple matches exist.
- 📜 Displays title, author, and lines.
- 🐍 Built in Python 3 using
requests. - 🌐 No local word lists required — poems are fetched live from the API.
- Python 3.7+
requestslibrary
Install dependencies:
pip install requests1.Clone the repository:
git clone https://github.com/<your-username>/<repo-name>.git
cd <repo-name>2.Run the script:
python random_poem_generator.py3.Enter a theme or keyword when prompted:
Enter a theme or keyword (e.g. love, rain, night): rainEnjoy the poem!