https://github.com/muhammadadnan1998/build_simple_apis_using_fastapi
A FastAPI-based project that provides two endpoints: one for generating random side hustle ideas and another for fetching money-related quotes. Includes API key authentication for secure access.
https://github.com/muhammadadnan1998/build_simple_apis_using_fastapi
fastapi python random-quotes-generator
Last synced: 10 months ago
JSON representation
A FastAPI-based project that provides two endpoints: one for generating random side hustle ideas and another for fetching money-related quotes. Includes API key authentication for secure access.
- Host: GitHub
- URL: https://github.com/muhammadadnan1998/build_simple_apis_using_fastapi
- Owner: MuhammadAdnan1998
- Created: 2025-03-06T17:33:48.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-06T18:31:27.000Z (over 1 year ago)
- Last Synced: 2025-06-10T04:02:29.528Z (about 1 year ago)
- Topics: fastapi, python, random-quotes-generator
- Language: Python
- Homepage:
- Size: 68.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# FastAPI Side Hustles & Money Quotes API
## Overview
This FastAPI-based project provides two simple API endpoints:
- `/side_hustles` – Returns a random side hustle idea.
- `/money_quotes` – Returns a random money-related quote.
Both endpoints require an API key for authentication.
## Features
- Fast and lightweight API built with **FastAPI**.
- Secure API key authentication.
- Randomized responses for dynamic content delivery.
## Installation & Setup
### Prerequisites
Ensure you have **Python 3.7+** installed.
### Steps
1. **Clone the repository**:
```sh
git clone https://github.com/your-username/your-repo.git
cd your-repo
```
2. **Create a virtual environment**:
```sh
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
```
3. **Install dependencies**:
```sh
pip install fastapi uvicorn
```
4. **Run the API server**:
```sh
uvicorn main:app --reload
```
## API Endpoints
### 1. Get a Random Side Hustle Idea
- **Endpoint**: `GET /side_hustles`
- **Query Parameter**: `api_key` (required)
- **Example Request**:
```sh
curl "http://127.0.0.1:8000/side_hustles?api_key=123456789"
```
- **Example Response**:
```json
{
"side_hustle": "Freelancing - Start offering your skills online!"
}
```
### 2. Get a Random Money Quote
- **Endpoint**: `GET /money_quotes`
- **Query Parameter**: `api_key` (required)
- **Example Request**:
```sh
curl "http://127.0.0.1:8000/money_quotes?api_key=123456789"
```
- **Example Response**:
```json
{
"money_quote": "Money is a terrible master but an excellent servant. – P.T. Barnum"
}
```
## Authentication
- API key is required for both endpoints.
- Example API key used: `123456789` (Change this for production use).
## Contribution
Feel free to contribute by submitting pull requests or reporting issues.
## License
This project is licensed under the MIT License.