PyAIL is a Python library to access AIL platforms via their REST API.
It is strongly recommended to use a virtual environment
If you want to know more about virtual environments, python has you covered
Install pyail:
pip3 install pyailfrom pyail import PyAIL
ail_url = 'https://localhost:7000'
ail_key = '<AIL API KEY>'
try:
pyail = PyAIL(ail_url, ail_key, ssl=False)
except Exception as e:
print(e)
sys.exit(0)
pyail.ping()For a reverse proxy using HTTP Basic authentication:
from requests.auth import HTTPBasicAuth
pyail = PyAIL(
'https://example.org/ail',
'<AIL API KEY>',
auth=HTTPBasicAuth('<PROXY USERNAME>', '<PROXY PASSWORD>'),
)data = 'my item content'
metadata = {}
source = '<FEEDER NAME>'
source_uuid = '<feeder UUID v4>'
pyail.feed_json_item(data, metadata, source, source_uuid)pyail.import_crawler_capture(capture={"last_redirected_url": "https://mywebsite.com", "html": "<html><body><h1>HELLO WORLD</h1></body></html>"})Export one chat, including its messages, subchannels, and threads, to a JSON file:
pyail.export_chat(
'<chat instance UUID>',
'<chat ID>',
'exports',
languages=['en', 'fr'],
)Export every chat from an instance:
pyail.export_chat_instance(
'<chat instance UUID>',
'exports',
languages=['en', 'fr'],
)Exports stream directly to disk and overwrite existing files. A single chat is saved as exports/<sanitized-chat-id>.json.
An instance is saved under exports/<sanitized-instance-uuid>/, with metadata.json and one file per chat in chats/. languages
can be a comma-separated string or a sequence of language tags.
This software is licensed under BSD 3-Clause License
Copyright (C) 2020-2026 CIRCL - Computer Incident Response Center Luxembourg
Copyright (C) 2020-2026 Aurelien Thirion