29th October 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
alephclientusing pip although I recommend to usepipxinstead:pipx install alephclientalephclientneeds 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_HOSTandALEPHCLIENT_API_KEY, respectively, or by passing them in with--hostand--api-keyoptions.export ALEPHCLIENT_HOST=https://aleph.occrp.org/ export ALEPHCLIENT_API_KEY=YOUR_SECRET_API_KEYYou can now start using
alephclientfor 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
alephclientCLI allows you to upload files in bulk much quicker and more reliable.Run the following
alephclientcommand to upload an entire directory to Aleph:alephclient crawldir --foreign-id wikileaks-cable /Users/sunu/data/cableThis 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.