Giter VIP home page Giter VIP logo

gdocrevisions's Introduction

gdocrevisions: Google Doc Revisions

pypi Build Status

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

  • Create a google service account and create a json credentials file.
  • Share a google doc with the service account email (e.g. [email protected])

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

Development environment

A Docker-based environment is specified for development and testing.

The environment variable GOOGLE_SERVICE_ACCOUNT_INFO must be populated in order to run tests. The variable should contain the text content of a Google service account file, for use with google.oauth2.service_account,.Credentials.from_service_account_info. It can be defined in a .envfile in the same directory asdocker-compose.yml`.

gdocrevisions's People

Contributors

kunanit avatar dseaton avatar

Stargazers

antaera avatar J DuClos avatar

Watchers

Peter Pinch avatar James Cloos avatar  avatar Igor Degtiarov avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.