gdocrevisions

Package for downloading and analyzing google doc revision history data.


License
MIT
Install
pip install gdocrevisions==1.0.1

Documentation

gdocrevisions: Google Doc Revisions

pypi

Python package to retrieve and process google doc revision history data.

Documentation

Documentation website: https://harvard-vpal.github.io/gdocrevisions/docs

Setup

Requirements

  • python 3

Installation

pip install gdocrevisions

Other steps

Usage

Code example demonstrating how to:

  • generate credentials with the google-auth library
  • load a document with the gdocrevisions GoogleDoc class
  • inspect a few attributes of the GoogleDoc object instance
from google.oauth2 import service_account
import gdocrevisions

# The file id can be found in the URL
# e.g. https://docs.google.com/document/d/<FILE_ID>
FILE_ID = 'abcdefg12345'

# Specify the service account credentials file
CREDENTIAL_FILE = 'my-credentials.json'
SCOPE = ['https://www.googleapis.com/auth/drive']
credentials = service_account.Credentials.from_service_account_file(CREDENTIAL_FILE, scopes=SCOPE)

# Initialize a GoogleDoc object instance, which retrieves revision data 
gdoc = gdocrevisions.GoogleDoc(FILE_ID, credentials)

# Doc and revision data is available in the object instance attributes
gdoc.metadata
gdoc.revisions
gdoc.revisions[0].operation