Paweł Łaba commited on
Commit
1b4ebab
·
1 Parent(s): 65849c8
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -1,4 +1,4 @@
1
- from fastapi import FastAPI, HTTPException
2
  from fastapi.responses import HTMLResponse
3
  from fastapi.staticfiles import StaticFiles
4
  from starlette.routing import Mount
@@ -69,13 +69,15 @@ async def read_root():
69
 
70
 
71
  @app.post("/move")
72
- async def get_move(data: dict):
73
  """
74
  Endpoint do wykonania ruchu AI
75
  """
76
  try:
 
77
  board = data.get("board")
78
 
 
79
  if not board:
80
  raise HTTPException(status_code=400, detail="Brak planszy w żądaniu")
81
 
 
1
+ from fastapi import FastAPI, HTTPException, Request
2
  from fastapi.responses import HTMLResponse
3
  from fastapi.staticfiles import StaticFiles
4
  from starlette.routing import Mount
 
69
 
70
 
71
  @app.post("/move")
72
+ async def get_move(request: Request):
73
  """
74
  Endpoint do wykonania ruchu AI
75
  """
76
  try:
77
+ data = await request.json() # Pobierz dane JSON z żądania
78
  board = data.get("board")
79
 
80
+
81
  if not board:
82
  raise HTTPException(status_code=400, detail="Brak planszy w żądaniu")
83