Skip to content

LisaS7/star-wars-planets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Star Wars Planet Browser

A flask app which retrieves and displays the Star Wars API (SWAPI) planet data. I made this app to learn how to use APIs and pytest. This is also the first app I've deployed to Heroku.

View App

Run locally

  1. Clone the repository
  2. Run setup.sh (command: bash setup.sh). This will create the virtual environment and install requirments.
  3. Activate the virtual environment (command: source venv/bin/activate)
  4. Run the app (command: flask run)
  5. Open a browser and go to http://localhost:5000/

API

BasicApi class: retrieves the data from SWAPI and caches it. I've tried to make this as reusable as possible for other APIs. I added caching as the requests were taking a few seconds to return data.

Planet class: takes the dictionary returned by the BasicApi class and uses the data to create a Planet object.

App

The main page displays all planets. These can be filtered by climate or terrain by clicking on the links in these fields.

What I learned:

  • Setting up linting in VSCode with Flake8 and changing settings
  • Using requests to get data from an API
  • Caching the response
  • Creating routes for variable URLs
  • Creating tests and fixtures with pytest
  • Improved CSS layout skills
  • Deploying to Heroku

Resources:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published