Add a Google Docs uploader (one doc per month) - #148
Merged
Conversation
Uploads notes to Google Docs with no browser and no interactive OAuth, using a Google service account. Keeps one document per month (found or created via the Drive API and optionally shared with a configured email), and lays notes out as day headings (Heading 1), per-session timestamp headings (Heading 2), and a nested bulleted list that mirrors the indent levels typed. - googledocs_api.py: Drive + Docs REST client (service-account auth, find/create/ share month docs, get document, batchUpdate). - googledocs_uploader.py: note-event -> structured Docs requests, with day/session dedup (re-learns the last day from the doc so restarts don't duplicate headings) and high-to-low request ordering so bullet creation never invalidates ranges. - runner dispatch for NOTE_TAKING_SYSTEM='googledocs'; settings template, settings UI, and google-auth dependency. - 34 unit tests (fake HTTP session / fake client), no network or Redis needed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…wn Drive) A service account cannot own files in a consumer Gmail Drive, so add support for authenticating as a Google user via a stored OAuth token (authorized_user JSON with a refresh_token) in addition to service-account keys. load_credentials() detects the kind by the JSON contents. Adds scripts/authorize_googledocs.py to run the one-time consent flow and produce the token, and tests for the routing. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a Google Docs note-taking backend (
NOTE_TAKING_SYSTEM=googledocs) that appends notes to a Google Doc — no browser, no interactive OAuth.Layout, one document per month:
How
googledocs_api.py— a small client for the Drive + Docs REST APIs. Auth is a Google service account (google-auth'sAuthorizedSession). It finds the current month's doc by name or creates it (Drivefiles), optionally in a folder and shared with a configured email, then reads the doc and applies abatchUpdate. Scopes aredocuments+drive.file(the app only ever sees docs it created).googledocs_uploader.py— turns note events into oneinsertTextof the whole batch followed by paragraph-style and bullet requests. Notable details:createParagraphBullets.Falseon any API error so notes stay queued.GOOGLE_DOCS_CREDENTIALS,GOOGLE_DOCS_SHARE_EMAIL,GOOGLE_DOCS_FOLDER_ID,GOOGLE_DOCS_TITLE_FORMAT), settings-server UI, and thegoogle-authdependency.Setup (for whoever configures a device)
/home/pi/secrets/google_credentials.json).:set GOOGLE_DOCS_SHARE_EMAIL you@gmail.comso each month's doc is shared to you. (Optionally setGOOGLE_DOCS_FOLDER_ID.):set NOTE_TAKING_SYSTEM googledocs.Testing
False). Local run: full suite 99 passed, ruff clean.🤖 Generated with Claude Code