-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ya docs handler #28
Ya docs handler #28
Conversation
9241ada
to
b20c44a
Compare
a67d12d
to
f82bc38
Compare
if data["private_path"] is None or data["oauth_token"] is None: | ||
raise ma.ValidationError("Both path and token must be provided for private files") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, not exactly
If we are working with an existing connection, we won't receive the token and we'll have to use the one saved inside the connection – it is only sent to the backend when the connection is created or the token is updated, we never give secrets back in our responses
(This can be fixed later as a different PR, when we have the pipeline going with actual connections)
lib/dl_file_uploader_api_lib/dl_file_uploader_api_lib/views/files.py
Outdated
Show resolved
Hide resolved
lib/dl_file_uploader_api_lib/dl_file_uploader_api_lib/views/files.py
Outdated
Show resolved
Hide resolved
lib/dl_file_uploader_worker_lib/dl_file_uploader_worker_lib/tasks/download_yadocs.py
Outdated
Show resolved
Hide resolved
lib/dl_file_uploader_worker_lib/dl_file_uploader_worker_lib/tasks/excel.py
Show resolved
Hide resolved
…sks/download_yadocs.py Co-authored-by: KonstantAnxiety <[email protected]>
|
||
task_processor = self.dl_request.get_task_processor() | ||
await task_processor.schedule(DownloadYaDocsTask(file_id=df.id)) | ||
LOGGER.info(f"Scheduled DownloadGSheetTask for file_id {df.id}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scheduled DownloadGSheetTask DownloadYaDocsTask
@@ -88,6 +89,10 @@ async def run(self) -> TaskResult: | |||
return Success() | |||
|
|||
dfile.filename = spreadsheet_meta["name"] | |||
xlsx_suffix = ".xlsx" | |||
if not dfile.filename.endswith(xlsx_suffix): | |||
raise exc.UnsupportedDocument |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's save the exact reason the file was rejected in the error details (in future PRs)
Something like this
raise exc.UnsupportedDocument(details={"reason": f"Supported file extensions are: '.xlsx'. Got {dfile.filename}"})
No description provided.