Spaces:
Sleeping
Sleeping
Commit
·
ea5a996
1
Parent(s):
3d87635
fix: request style
Browse files
app.py
CHANGED
@@ -99,9 +99,11 @@ async def upload(
|
|
99 |
|
100 |
@app.post("/image2")
|
101 |
async def upload(
|
102 |
-
o: ImageObject,
|
103 |
x_request_user: str = Header(...),
|
104 |
x_api_key: str = Header(...),
|
|
|
|
|
|
|
105 |
file: UploadFile = File(...)
|
106 |
):
|
107 |
res = Response()
|
@@ -113,7 +115,7 @@ async def upload(
|
|
113 |
res.status = HTTPStatus.FORBIDDEN
|
114 |
res.error = "Invalid credentials"
|
115 |
else:
|
116 |
-
key = f'{
|
117 |
logging.info(f'Key for S3 upload: {key}')
|
118 |
|
119 |
try:
|
@@ -130,7 +132,7 @@ async def upload(
|
|
130 |
res.error = str(e)
|
131 |
logging.warning(f"Error during upload: {res.error}")
|
132 |
|
133 |
-
res.data =
|
134 |
return res
|
135 |
|
136 |
def is_valid(u, p):
|
|
|
99 |
|
100 |
@app.post("/image2")
|
101 |
async def upload(
|
|
|
102 |
x_request_user: str = Header(...),
|
103 |
x_api_key: str = Header(...),
|
104 |
+
x_job_no: str = Header(...),
|
105 |
+
x_file_path: str = Header(...),
|
106 |
+
x_ref: str = Header(...),
|
107 |
file: UploadFile = File(...)
|
108 |
):
|
109 |
res = Response()
|
|
|
115 |
res.status = HTTPStatus.FORBIDDEN
|
116 |
res.error = "Invalid credentials"
|
117 |
else:
|
118 |
+
key = f'{x_file_path}/{x_job_no}/{file.name}'
|
119 |
logging.info(f'Key for S3 upload: {key}')
|
120 |
|
121 |
try:
|
|
|
132 |
res.error = str(e)
|
133 |
logging.warning(f"Error during upload: {res.error}")
|
134 |
|
135 |
+
res.data = x_ref
|
136 |
return res
|
137 |
|
138 |
def is_valid(u, p):
|