alephclientis a command-line client for Aleph. It can be used to bulk import document sets via the API, without direct access to the server.
alephclient, you need to have Python 3 installed and working on your computer. You may also want to create a virtual environment using
pyenv. With that done, type:
alephclientneeds to know the url of an Aleph instance that it will connect to. For privileged operations, it will also need to know the user's API key. The API key can be found in the users profile page on the Aleph web application.
ALEPHCLIENT_API_KEYrespectively; or by passing them in with
--api-keyoptions directly for the command. The examples below will assume you have set up the environment variables:
crawldircommand crawls through a given directory recursively and uploads all the files and directories inside it to a collection. The external identifier (foreign ID) of the target collection needs to be passed to the command with
--foreign-idoption. If a collection with the given foreign ID does not exist, it will be created. The
pathargument needs to be a valid path to a file or directory:
--languageoption, which expects a 3-letter ISO 639 language code. It can be specified multiple times, for when the directory contains files in more than one language.
write-entitiescommand, users can load JSON-formatted entities formatted in the
followthemoneystructure into an aleph collection. This can be used in conjunction with the command-line tools for generating such data provided by
followthemoney. Data that is loaded this way should be aggregated before being written to the API, for example using the
ftm aggregatecommand-line utility, or the
stream-entitiesis the inverse of
write-entities. It will stream entities from the given Aleph instance so that they can be written to a file or piped into another processing step:
bulkloadcommand executes an entity mapping within the Aleph system. Its only argument is a YAML mapping file: