Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

download_openicpsr-private.py - Download files from private openICPSR deposits

Description

This script authenticates with openICPSR and downloads all files from a private deposit as a ZIP archive, then extracts it to a local directory. It’s designed for downloading draft/unpublished deposits that require authentication and are not publicly accessible.

Usage

python3 tools/download_openicpsr-private.py PROJECT_ID [path] [login]

Arguments

Examples

# Using environment variables for authentication
export ICPSR_EMAIL="your.email@domain.com"
export ICPSR_PASS="your_password"
python3 tools/download_openicpsr-private.py 123456

# Specifying download path
python3 tools/download_openicpsr-private.py 123456 ./downloads

# Interactive login (will prompt for password)
python3 tools/download_openicpsr-private.py 123456 ./downloads your.email@domain.com

# Using config file (config.yml with openicpsr: PROJECT_ID)
python3 tools/download_openicpsr-private.py

Authentication Methods

The script supports multiple authentication methods in order of preference:

  1. Interactive Authentication: Command line login + password prompt

  2. Environment Variables: ICPSR_EMAIL and ICPSR_PASS

  3. Config File: config.yml with openicpsr: PROJECT_ID

Environment Variables

Features

How It Works

  1. Authentication: Authenticates with openICPSR using provided credentials

  2. Project Access: Accesses private/unpublished deposit by PROJECT_ID

  3. Download: Downloads complete deposit as ZIP archive

  4. Extraction: Extracts ZIP contents to local directory

  5. Organization: Maintains file structure from original deposit

Output Structure

PROJECT_ID/                 # Directory named after project ID
├── data/                   # Extracted data files
├── programs/               # Code and scripts
├── documentation/          # README and documentation
└── ...                     # Other deposit contents

Config File Format

Create a config.yml file with:

openicpsr: 123456  # Your project ID

Security Considerations

Error Handling

Requirements

This tool is essential for research workflows that require access to unpublished or private openICPSR deposits during the replication process.