epikulski / digitalarchive

A Python client and ORM for the Wilson Center's Digital Archive.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This client no longer functions -- the Wilson Center has disabled API access to the Digital Archive

Digital Archive

PyPI codecov PyPI - Python Version Documentation Status

A Python client for the Wilson Center's Digital Archive ("DA") of historical primary sources. This library provides an ORM for searching and accessing documents and other resources in the Digital Archive.

Installation

The client is available on pypi. It requires python 3.7+.

pip install digitalarchive

Usage

>>> import digitalarchive

# Search for documents:
>>> soviet_docs = digitalarchive.Document.match(title="soviet").all()

# Collections and other resource types are also searchable.
>> soviet_collections = digitalarchive.Collection.match(name="soviet")

# Grab a single, specific document:
>>> document = digitalarchive.Document.match(id="112566").first()

# Pull transcripts, translations, and original scans of documents:
>>> document.hydrate()
>>> document = test_doc.transcripts[0].html

# Pull the metadata and other assets for an entire resultset.
>>> chernobyl_docs = digitalarchive.Document.match(title="chernobyl")
>>> chernobyl_docs.hydrate()
>>> chernobyl_docs.all()

# Or just download all the documents!
>>> all_documents = digitalarchive.Document.match().all()

Complete documentation for the client and the Digital Archive's models are available here.

Disclaimers

  • This is an unofficial library. I am not presently affiliated with the Wilson Center. I understandthat the API is unlikely to change in the near future, but I cannot guarantee that this library won't break without warning.
  • If you plan to scrape the DA, please be respectful.

Planned Features

  • Support for searching by date range.
  • Asynchronous hydration of large result sets.
  • For Collections, inlcude keyword hits in short_description for searches. (modify collection searches to use the record.json instead of collection.json endpoint.

About

A Python client and ORM for the Wilson Center's Digital Archive.

License:MIT License


Languages

Language:Python 100.0%