FastAPI परिचय
Matt Eckerle
Software and Data Engineering Leader
HTTP प्रोटोकॉल - कई प्रकार के ऑपरेशंस
उदाहरण: https://www.google.com:80/search?q=fastapi
GET रिक्वेस्ट के मुख्य भाग:
www.google.com80 (डिफ़ॉल्ट)/search?q=fastapiसबसे सरल FastAPI एप्लिकेशन:
from fastapi import FastAPI# Instantiate app app = FastAPI()# Handle get requests to root @app.get("/") def root(): return {"message": "Hello World"}
मुख्य cURL विकल्प:
$ curl -h
Usage: curl [options...] <url>
-v, --verbose Make the operation more talkative
-H, --header <header/@file> Pass custom header(s) to server
-d, --data <data> HTTP POST data
उपयोग का उदाहरण:
$ curl http://localhost:8000
{"message":"Hello World"}
नया एंडपॉइंट:
@app.get("/hello")
def hello(name: str = "Alan"):
return {"message": f"Hello {name}"}
रिक्वेस्ट में नाम नहीं:

रिक्वेस्ट में नाम:

FastAPI परिचय