Skip to content
Adrian Turner edited this page Jan 26, 2024 · 8 revisions

Prerequisites for nuxeo_spreadsheet

  • a python environment (python version 3.6). Anaconda or virtualenv recommended.
  • set up pynux, CDL's wrapper for the Nuxeo API, inside your python environment
  • install unicodecsv inside you python environment
  • obtain an API token for Nuxeo and put it in your pynux config file

Each of these prerequisites is explained further below.

1. Python environment

  • "Anaconda" is a python distribution that will work on Windows, Mac, and Linux. This option is particularly recommended for our Windows users. We don't use the scientific packages that come with a full install of Anaconda, so installation of the miniconda distribution is recommended
  • -- OR --
  • use of virtualenv is recommend with your system python. If you don't have the virtualenv you might need to easy_install virtualenv

If you've installed miniconda in Windows, here's a walkthrough of steps to establish the python environment:

  • Open the Command Prompt from the Start menu
  • Go to your home directory, e.g. cd C:\Users\yourname\
  • Establish the new python environment. In this example, "venv" is the name we're using to name the environment: conda create -n venv python
  • Activate that new python environment: activate venv

2. Install nuxeo_spreadsheet

In your python environment (e.g., venv), install nuxeo_spreadsheet from https://github.com/ucldc/nuxeo_spreadsheet -- either by downloading the zip file or checking out the repository with git. For Windows users, this will install the nuxeo_spreadsheet package in your home directory (e.g., C:\Users\yourname\nuxeo_spreadsheet).

git clone https://github.com/ucldc/nuxeo_spreadsheet.git

If you ever need to grab the most current version of the code, use git pull origin master

3. Install requirements

Make sure you are in your python environment (e.g., venv) and go into the nuxeo_spreadsheet directory.

cd nuxeo_spreadsheet
pip install -r requirements.txt

4. If using Google Sheets for export or ingest; Else go to step 4

Follow the instructions in the link below. Google-Sheets-Set-Up

5. Obtain an API token

The process will involve using the Nuxeo API to import metadata in tab-delimited spreadsheet format. Access through the Nuxeo API is supported through basic and token authentication, as described at UCLDC Documentation.

For token authentication, you can use a bash script to get a token, e.g. https://nuxeo.cdlib.org/nuxeo/authentication/token?applicationName=API+ACCESS&deviceId=###.##.###.##&deviceDescription=&permission=rw (indicate your public IP in the deviceId parameter).

6. Set up ~/.pynuxrc with API token

Go back to the home directory cd C:\Users\yourname\ Create a configuration file named .pynuxrc (no filename extension), with the API token; use a text editor, etc. to create the configuration file. You can use the "Auth Token" example file as a template. The only thing you'll need to add is the API token, replacing the value xxx with the token.

Save the .pynuxrc configuration file to the home directory on your workstation (e.g. in Windows, at C:\Users\yourname).

7. Test connection to Nuxeo

In your python environment (e.g., venv), run this command to confirm the connection:

(venv)$ nxls /
d0ba6352-44c6-4f25-b9f9-667131d3eaf2	/asset-library
992f30c0-318c-457c-a04a-921222c8ba89	/default-domain