Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
from fastapi import FastAPI, Request
|
2 |
from fastapi.responses import PlainTextResponse
|
3 |
import uvicorn
|
|
|
4 |
|
5 |
app = FastAPI()
|
6 |
|
@@ -10,10 +11,13 @@ async def proxy(request: Request, full_path: str):
|
|
10 |
|
11 |
if auth_header:
|
12 |
output = f'"authorization": {auth_header}'
|
13 |
-
print(output) # This will appear in the logs
|
14 |
return PlainTextResponse(output)
|
15 |
else:
|
16 |
return PlainTextResponse("No authorization header found")
|
17 |
|
18 |
if __name__ == "__main__":
|
19 |
-
uvicorn.run(app, host="0.0.0.0", port=7860)
|
|
|
|
|
|
|
|
1 |
from fastapi import FastAPI, Request
|
2 |
from fastapi.responses import PlainTextResponse
|
3 |
import uvicorn
|
4 |
+
import sys
|
5 |
|
6 |
app = FastAPI()
|
7 |
|
|
|
11 |
|
12 |
if auth_header:
|
13 |
output = f'"authorization": {auth_header}'
|
14 |
+
print(output, flush=True) # This will appear in the logs
|
15 |
return PlainTextResponse(output)
|
16 |
else:
|
17 |
return PlainTextResponse("No authorization header found")
|
18 |
|
19 |
if __name__ == "__main__":
|
20 |
+
uvicorn.run(app, host="0.0.0.0", port=7860, log_level="critical")
|
21 |
+
|
22 |
+
# Redirect uvicorn's error logs to devnull
|
23 |
+
sys.stderr = open('/dev/null', 'w')
|