gdocs-client
I extracted this small synchronous client for integrations that create Google Docs documents and append or read plain text. It uses Google's official Python client and has no Home Assistant dependency.
Install
pip install gdocs-client
Use
I keep OAuth authorization and token refresh in the calling application. Each operation takes a valid access token and closes its HTTP connection when it finishes.
from gdocs_client import append_text, create_document, get_document
access_token = "YOUR_ACCESS_TOKEN"
document = create_document(access_token, "Daily log")
document_id = document["documentId"]
append_text(access_token, document_id, "The washing machine finished.\n")
result = get_document(access_token, document_id)
print(result["title"])
print(result["text"])
# Check access without retrieving document content.
metadata = get_document(access_token, document_id, include_content=False)
I use the first document tab. Appends preserve the supplied text and do not add a timestamp, separator, or newline. Writes are not automatically retried, since an uncertain result could otherwise duplicate text.
The text field includes text runs in paragraphs, nested tables, and tables of contents in document order. It removes Google's mandatory final newline and preserves all other newlines. Formatting, images, headers, footers, and footnotes are not included. Metadata-only reads do not add a text field.
Google authentication and HTTP errors propagate to the caller. API_ERRORS groups the expected authentication, HTTP, transport, and operating system errors for applications that need a shared handler.
Development
pip install -e '.[test]'
ruff check .
ruff format --check .
mypy src
pytest --cov --cov-report=term-missing
python -m build
twine check dist/*
I publish releases through the repository's GitHub Actions workflow using PyPI Trusted Publishing. Each release tag matches the package version and publishes a wheel and source distribution.
Metadata
Release files for gdocs-client 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gdocs_client-0.1.0.tar.gz | 9.4 kB | With provenance | Details for gdocs_client-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gdocs_client-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for gdocs_client-0.1.0-py3-none-any.whl |
Total release size: 17.3 kB
Release files / gdocs_client-0.1.0.tar.gz
| Download URL | gdocs_client-0.1.0.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
715804ce0ac73cec6057ac0c6251241f87bea83604fdefedaad7807676db04ec
|
|
BLAKE2b-256 checksum How to use checksums |
2ad95d0955dba277a3cdde85e8dc902f95e1472e1f6dd207be0048f5860252b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logRelease files / gdocs_client-0.1.0-py3-none-any.whl
| Download URL | gdocs_client-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
49b3d8adfc8db6f28d9617697fd1bc45b9b9a64d4d079b96f3505d3dad40e226
|
|
BLAKE2b-256 checksum How to use checksums |
f932043770d2fbe36d204c490887d8cbd71f6d00fd54f5f6025b96cfee929197
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logSecurity for gdocs-client 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for gdocs_client-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.