Skip to content

Commit bd84928

Browse files
pushing changes
1 parent a14fc25 commit bd84928

File tree

5 files changed

+40
-0
lines changed

5 files changed

+40
-0
lines changed

practice/library/__init__.py

Whitespace-only changes.

practice/library/main.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from fastapi import FastAPI
2+
from pydantic import BaseModel
3+
app = FastAPI()
4+
5+
6+
class BookCreateModel(BaseModel):
7+
title: str
8+
author: str
9+
10+
11+
@app.post("/create_book")
12+
async def create_book(book_data: BookCreateModel):
13+
return {
14+
"title": book_data.title,
15+
"author": book_data.author
16+
}

practice/vehicle/__init__.py

Whitespace-only changes.

practice/vehicle/main.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from fastapi import FastAPI
2+
import asyncio
3+
4+
# creates an instance of the FastAPI class
5+
app = FastAPI()
6+
7+
8+
@app.get("/")
9+
async def read_root():
10+
"""
11+
await = pauses execution of this function until asyncio.sleep(2)
12+
"""
13+
await asyncio.sleep(2)
14+
return {"message": "Hello world"}

requirements.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
fastapi[all]
2+
pydantic[email]
3+
slowapi
4+
beautifulsoup4
5+
requests
6+
httpx
7+
sqlalchemy
8+
uvicorn
9+
uvicorn[standard]
10+
asyncio

0 commit comments

Comments
 (0)