October of 2024
Life Management⚑
Knowledge Management⚑
Aleph⚑
-
alephclient is a command-line client for Aleph. It can be used to bulk import structured data and files and more via the API, without direct access to the server.
You can now install
alephclient
using pip although I recommend to usepipx
instead:pipx install alephclient
alephclient
needs to know the URL of the Aleph instance to connect to. For privileged operations (e.g. accessing private datasets or writing data), it also needs your API key. You can find your API key in your user profile in the Aleph UI.Both settings can be provided by setting the environment variables
ALEPHCLIENT_HOST
andALEPHCLIENT_API_KEY
, respectively, or by passing them in with--host
and--api-key
options.export ALEPHCLIENT_HOST=https://aleph.occrp.org/ export ALEPHCLIENT_API_KEY=YOUR_SECRET_API_KEY
You can now start using
alephclient
for example to upload an entire directory to Aleph.Upload an entire directory to Aleph While you can upload multiple files and even entire directories at once via the Aleph UI, using the
alephclient
CLI allows you to upload files in bulk much quicker and more reliable.Run the following
alephclient
command to upload an entire directory to Aleph:alephclient crawldir --foreign-id wikileaks-cable /Users/sunu/data/cable
This will upload all files in the directory
/Users/sunu/data/cable
(including its subdirectories) into an investigation with the foreign IDwikileaks-cable
. If no investigation with this foreign ID exists, a new investigation is created (in theory, but it didn't work for me, so manually create the investigation and then copy it's foreign ID).If you’d like to import data into an existing investigation and do not know its foreign ID, you can find the foreign ID in the Aleph UI. Navigate to the investigation homepage. The foreign ID is listed in the sidebar on the right.