QuoteAPI is a simple and efficient RESTful API for managing quotes, built using FastAPI. It allows users to fetch random quotes, add new quotes, update existing quotes, and delete quotes. The quotes are stored in an SQLite3 database, and the API ensures secure modifications through token-based authentication.
- Fetch Random Quote: Retrieve a random quote from the database.
- Add New Quote: Securely add a new quote to the database using a secret token.
- Update Existing Quote: Update the details of an existing quote with token authentication.
- Delete Quote: Delete a quote from the database with token authentication.
- Documentation: Auto-generated documentation available through Swagger UI and ReDoc.
- FastAPI: A modern, fast (high-performance), web framework for building APIs with Python 3.7+.
- SQLite3: A C-language library that implements a small, fast, self-contained, high-reliability, full-featured, SQL database engine.
- python-dotenv: Reads key-value pairs from a
.env
file and can set them as environment variables.
-
Clone the repository:
git clone https://github.com/ZodiackiIler/QuoteAPI.git cd QuoteAPI
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the dependencies:
pip install -r requirements.txt
-
Set up the database:
python init_db.py
-
Create a
.env
file and add your secret token:SECRET_TOKEN=your_secret_token
-
Run the API server:
uvicorn main:app --reload
-
Access the API documentation:
- Swagger UI: http://127.0.0.1:8000/docs