Python SDK for Dilnaka file uploads
Project description
Dilnaka Python SDK
Python SDK for uploading files through the Dilnaka Upload API.
The SDK reads configuration from explicit arguments first, then environment variables. It requests a presigned S3 upload URL from your Dilnaka backend, uploads the file directly to S3, and calls the completion endpoint.
Install
pip install dilnaka
To create the workspace AI instruction file explicitly after install:
dilnaka-sync-instructions --print-path
The SDK also attempts a best-effort sync the first time Dilnaka(...) is constructed in an application workspace. That creates .github/instructions/dilnaka.instructions.md when the current project root can be detected.
Configure
You can pass configuration directly to Dilnaka(...), or set environment variables for your application.
If you use a .env file, create it in your application project:
DILNAKA_API_KEY=dlk_dev_your_api_key_here
DILNAKA_BASE_URL=https://dilnaka.tsnc.tech
DILNAKA_TIMEOUT=60
DILNAKA_BASE_URL defaults to https://dilnaka.tsnc.tech and DILNAKA_TIMEOUT defaults to 60.
Basic upload
from dilnaka import Dilnaka
client = Dilnaka()
uploaded = client.upload("./test-upload.txt")
print(uploaded.id)
print(uploaded.key)
print(uploaded.status)
Explicit configuration
from dilnaka import Dilnaka
client = Dilnaka(
api_key="dlk_dev_your_api_key_here",
base_url="https://dilnaka.tsnc.tech",
)
uploaded = client.upload("./avatar.png", folder="avatars")
print(uploaded)
Expected backend endpoints
The SDK expects your Caspian backend to expose:
POST /v1/uploads/presign
POST /v1/uploads/complete
GET /v1/files
GET /v1/files/{file_id}
DELETE /v1/files/{file_id}
Presign response shape
{
"fileId": "clx_file_id",
"fileKey": "uploads/2026/05/clx_file_id-test.txt",
"uploadUrl": "https://s3-presigned-url",
"expiresIn": 300,
"method": "PUT",
"headers": {
"Content-Type": "text/plain"
}
}
Complete response shape
{
"fileId": "clx_file_id",
"status": "uploaded",
"key": "uploads/2026/05/clx_file_id-test.txt",
"originalName": "test.txt",
"contentType": "text/plain",
"size": 94,
"publicUrl": null
}
Security model
The SDK never receives AWS credentials. It only receives a temporary presigned upload URL from your Dilnaka backend.
Your backend remains responsible for API key validation, scope checking, file validation, S3 key generation, metadata persistence, and upload completion verification.
AI workspace instructions
Python packaging does not provide a reliable cross-environment post-install hook for wheel installs, so the SDK ships its own instruction-file generator instead of trying to mutate arbitrary projects during pip install.
Use dilnaka-sync-instructions in install scripts when you need deterministic creation, or rely on the SDK's best-effort first-use sync when Dilnaka(...) is instantiated.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dilnaka-0.0.3.tar.gz.
File metadata
- Download URL: dilnaka-0.0.3.tar.gz
- Upload date:
- Size: 25.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e47dbf26769fa5cc157e5885da2afcb7c9bb025d716fc90c92b0e21d7f967782
|
|
| MD5 |
1bda29e01c8bb76ffc3f0a5f6f41c2fa
|
|
| BLAKE2b-256 |
8844c5ed72e9c7e5c74cbd9c8bb5c8d328d417ace5d15305ccb050b5d7be6c72
|
File details
Details for the file dilnaka-0.0.3-py3-none-any.whl.
File metadata
- Download URL: dilnaka-0.0.3-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77d4301f1bc9c2a532c19c455b10496c864d222e99716b0e8fe55ec090d6dbcf
|
|
| MD5 |
67b184e842fd26aacc2ea4b25cc8d75c
|
|
| BLAKE2b-256 |
7f00d729189d84f9d46ebaab95ffc64206660863ca38239ad65161cb99eeda81
|