Abhishek Thakur
commited on
Commit
·
81cb2cd
1
Parent(s):
a9995ee
oauth new submission
Browse files- competitions/app.py +7 -3
competitions/app.py
CHANGED
@@ -216,16 +216,20 @@ async def my_submissions(request: Request, user: User):
|
|
216 |
|
217 |
@app.post("/new_submission", response_class=JSONResponse)
|
218 |
async def new_submission(
|
|
|
219 |
submission_file: UploadFile = File(None),
|
220 |
hub_model: str = Form(...),
|
221 |
-
token: str = Form(
|
222 |
submission_comment: str = Form(None),
|
223 |
):
|
224 |
if submission_comment is None:
|
225 |
submission_comment = ""
|
226 |
|
227 |
-
|
228 |
-
|
|
|
|
|
|
|
229 |
|
230 |
todays_date = datetime.datetime.now()
|
231 |
start_date = datetime.datetime.strptime(START_DATE, "%Y-%m-%d")
|
|
|
216 |
|
217 |
@app.post("/new_submission", response_class=JSONResponse)
|
218 |
async def new_submission(
|
219 |
+
request: Request,
|
220 |
submission_file: UploadFile = File(None),
|
221 |
hub_model: str = Form(...),
|
222 |
+
token: str = Form(None),
|
223 |
submission_comment: str = Form(None),
|
224 |
):
|
225 |
if submission_comment is None:
|
226 |
submission_comment = ""
|
227 |
|
228 |
+
if request.session.get("oauth_info") is not None:
|
229 |
+
token = request.session.get("oauth_info")["access_token"]
|
230 |
+
|
231 |
+
if token is None:
|
232 |
+
return {"response": "Invalid token"}
|
233 |
|
234 |
todays_date = datetime.datetime.now()
|
235 |
start_date = datetime.datetime.strptime(START_DATE, "%Y-%m-%d")
|