Skip to content
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

Merged
merged 11 commits into from
Nov 3, 2023
Merged

Ya docs handler #28

merged 11 commits into from
Nov 3, 2023

Conversation

vallbull
Copy link
Contributor

No description provided.

Copy link

github-actions bot commented Nov 1, 2023

Test Results

171 tests   137 ✔️  7m 46s ⏱️
    4 suites    34 💤
    4 files        0

Results for commit a790345.

♻️ This comment has been updated with latest results.

Comment on lines +29 to +30
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")
Copy link
Contributor

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)


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}")
Copy link
Contributor

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
Copy link
Contributor

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}"})

@vallbull vallbull merged commit 19693db into main Nov 3, 2023
9 of 10 checks passed
@vallbull vallbull deleted the ya_docs_handler branch November 3, 2023 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants