Debian Codegraph @

docs_src/response_directly/tutorial002_py310.py

raw
1 from fastapi import FastAPI, Response
2
3 app = FastAPI()
4
5
6 @app.get("/legacy/")
7 def get_legacy_data():
8 data = """<?xml version="1.0"?>
9 <shampoo>
10 <Header>
11 Apply shampoo here.
12 </Header>
13 <Body>
14 You'll have to use soap here.
15 </Body>
16 </shampoo>
17 """
18 return Response(content=data, media_type="application/xml")