SDKs
Use KLOAKD from your own code
SDKs 0.7.0 for Python, TypeScript, Go and Java. Each one covers the same modules, waits out long requests for you and raises typed errors.
Install
Four languages, one API
Each example reads a list page and returns one record per book. Two CSS selectors pick the fields.
Python
Python 3.9 or laterpip install "kloakd-sdk>=0.7.0"from kloakd import Kloakd
client = Kloakd(api_key="sk-live-...", organization_id="your-org-id")
data = client.kolektr.page(
"https://books.toscrape.com",
schema={"title": "css:h3 a", "price": "css:p.price_color"},
item_selector="article.product_pod",
)
print(data.total_records) # 20: one record per bookWhen all your running jobs are busy, it raises ConcurrencyLimitError.
TypeScript
Node.js 18 or later; ESM and CommonJSnpm install kloakd-sdk@^0.7.0import { Kloakd } from "kloakd-sdk";
const client = new Kloakd({ apiKey: "sk-live-...", organizationId: "your-org-id" });
const data = await client.kolektr.page("https://books.toscrape.com", {
schema: { title: "h3 a", price: ".price_color" },
itemSelector: "article.product_pod",
});
console.log(data.totalRecords); // 20: one record per bookWhen all your running jobs are busy, it raises ConcurrencyLimitError.
Go
Go 1.18 or latergo get github.com/kloakd-dev/kloakd-go@v0.7.0client, _ := kloakd.New(kloakd.Config{APIKey: "sk-live-...", OrganizationID: "your-org-id"})
data, _ := client.Kolektr.Extract(ctx, "https://books.toscrape.com", &kloakd.ExtractOptions{
ItemSelector: "article.product_pod",
Fields: []kloakd.SchemaField{
{Name: "title", Selector: "h3 a"},
{Name: "price", Selector: "p.price_color"},
},
})
fmt.Println(data.TotalRecords) // 20: one record per bookWhen all your running jobs are busy, it raises ConcurrencyLimitError.
Java
Java 21 or later; Maven or Gradleimplementation 'dev.kloakd:kloakd-sdk:0.7.0'Kloakd client = Kloakd.builder()
.apiKey("sk-live-...").organizationId("your-org-id").build();
ExtractionResult data = client.kolektr().extract("https://books.toscrape.com",
ExtractOptions.builder()
.schema(Map.of("title", "css:h3 a", "price", "css:p.price_color"))
.itemSelector("article.product_pod")
.build());
System.out.println(data.totalRecords()); // 20: one record per bookWhen all your running jobs are busy, it raises ConcurrencyLimitException.
Long requests
The SDKs wait for you
A request still running after about 85 seconds is handed off as a job. The SDKs follow the job and return the finished result, the same as a direct answer.
Give your agent the web.
Free for 30 days with 0.5 GB of data. No card needed to start.
