Skip to content

Installation and test procedure

Martin 'Hasan' Bramwell edited this page Jan 7, 2014 · 18 revisions

These steps explain how to install and test my version of Anton's gspread:

Prerequisites

sudo apt-get -y install unzip python-pip python-nose
#
sudo pip install oauth2client virtualenv virtualenvwrapper

Prepare virtual environment

export WORKON_HOME=~/.python_vms
mkdir $WORKON_HOME
# 
pip completion --bash >> ~/.bashrc
echo "export WORKON_HOME=$WORKON_HOME" >> ~/.bashrc
echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc
echo "alias mkvirtualenv='mkvirtualenv --no-site-packages --distribute'" >> ~/.bashrc
echo "export PIP_VIRTUALENV_BASE=$WORKON_HOME" >> ~/.bashrc
source ~/.bashrc
#
mkdir -p projects
cd projects

Get a copy of gspread

wget https://github.com/FleetingClouds/gspread/archive/master.zip
unzip master.zip
mv gspread-master gspread

Controlling virtual environments

Make a new one:

mkvirtualenv test

Stop using it:

workon test

Use an existing one:

deactivate

Delete one:

rmvirtualenv test

Prepare test configuration

Make a copy of the example configuration

cd /home/yourself/projects/gspread
cp tests/tests.config.example tests/tests.config

Edit the UID/pwd details to begin to access Google Drive. Run the tests, expecting errors:

nosetests

You will see "SpreadsheetNotFound" errors, for nearly all the tests.

Fill in all the remaining details, and test again. Explanations are interspersed with the settings fields.

Google OAuth authentication

To use Google OAuth authentication, please follow the instructions, How to get, use and refresh OAuth access tokens for gspread.

Clone this wiki locally