Skip to content

Commit

Permalink
Revert "Trace for the API requests (#83)" (#84)
Browse files Browse the repository at this point in the history
This reverts commit 3478375.
  • Loading branch information
sanjibansg authored Feb 20, 2024
1 parent 3478375 commit 70bdf7e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
15 changes: 1 addition & 14 deletions api/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import json

from fastapi import Request

import substrait_validator as sv
from duckdb import DuckDBPyConnection
from fastapi import (Depends, FastAPI, File, Form, HTTPException, UploadFile,
Expand Down Expand Up @@ -237,7 +235,6 @@ def add_schema(
############################################################
@router.post("/parse/", status_code=status.HTTP_200_OK)
def parse_to_substrait(
request: Request,
data: dict,
headers: dict = Depends(verify_token),
db_conn: DuckDBPyConnection = Depends(get_duck_conn),
Expand All @@ -255,17 +252,7 @@ def parse_to_substrait(
response (dict): Response JSON for translated
Substrait plan
'''
content_type = request.headers.get("Content-Type")
authorization = request.headers.get("Authorization")
url = request.url

logger.info("content type: " + str(content_type))
logger.info("authorization: " + str(authorization))
logger.info("url: " + str(url))
logger.info("headers: " + str(headers))
logger.info("input data: " + str(data))
response = parse_from_duckDB(data.get("query"), db_conn)
logger.info("Response: " + str(response))
return response


Expand All @@ -286,7 +273,7 @@ def substrait_fiddle_openapi():
return app.openapi_schema


app = FastAPI(debug=True)
app = FastAPI()
app.include_router(router, prefix="/api/route")
app.openapi = substrait_fiddle_openapi

Expand Down
3 changes: 0 additions & 3 deletions api/components/auth.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os

from loguru import logger
import jwt
from fastapi import Depends, HTTPException, status
from fastapi.security import OAuth2PasswordBearer
Expand All @@ -12,10 +11,8 @@
############################################################
def verify_token(token: str = Depends(oauth2_scheme)):
try:
logger.info("token: " + str(token))
payload = jwt.decode(token, os.environ.get("VITE_SESSION_SECRET"),
algorithms=["HS256"])
logger.info("payload: " + str(payload))
return payload
except jwt.exceptions.DecodeError:
raise HTTPException(
Expand Down

0 comments on commit 70bdf7e

Please sign in to comment.