2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
- from fastapi import FastAPI, Response
-
- app = FastAPI()
-
-
- # ① xml
- @app.get("/legacy")
- def get_legacy_data():
- data = """<?xml version="1.0"?>
- <shampoo>
- <Header>
- Apply shampoo here.
- </Header>
- <Body>
- You'll have to use soap here.
- </Body>
- </shampoo>
- """
- return Response(content=data, media_type="application/xml")
Inspice reditus actuales:
Genus regressus in forma xml est, reditus prosperum esse significans.
- @app.get("/legacy_with_headers")
- def get_legacy_with_headers_data():
- headers = {"X-Xtoken": "LC", "Content-Language": "en-US"}
- data = """<?xml version="1.0"?>
- <shampoo>
- <Header>
- Apply shampoo here.
- </Header>
- <Body>
- You'll have to use soap here.
- HERE SOMETHING HEADER YOU DEFINED
- </Body>
- </shampoo>
- """
- return Response(content=data, media_type="application/xml", headers=headers)
Inspice reditus actuales
Interface correspondens normaliter redire potest, et Capituli respondentes regulariter redire possunt.
- @app.get("/legacy_with_header_cookie")
- def legacy_with_header_cookie():
- headers = {"X-Xtoken": "LC-1", "Content-Language": "en-US"}
- data = """<?xml version="1.0"?>
- <shampoo>
- <Header>
- Apply shampoo here.
- </Header>
- <Body>
- You'll have to use soap here.
- HERE SOMETHING HEADER YOU DEFINED AND COOKIE
- </Body>
- </shampoo>
- """
- response = Response(content=data, media_type="application/xml", headers=headers)
- response.set_cookie(key="cookie_key_lc", value="mrli")
- return response
Inspice reditus actuales
Interface crustulum quod constituimus normaliter reddere potest, et capitis capitales etiam normaliter reddi possunt.