Metadata-Version: 2.4
Name: voiddo-utils
Version: 1.1.3
Summary: Python client for the vøiddo utilities API (data.voiddo.com): PDF, image, QR, CSV/Excel, JSON/YAML conversion, HTML to PDF, DNS/RDAP and other lookups.
Author-email: voiddo studio <data@voiddo.com>
License-Expression: MIT
Project-URL: Homepage, https://data.voiddo.com
Project-URL: Documentation, https://data.voiddo.com/llms.txt
Project-URL: OpenAPI, https://data.voiddo.com/openapi.json
Keywords: pdf,qr-code,image-convert,csv,json-schema,dns,rdap,api-client,mcp
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.20
Dynamic: license-file

# voiddo-utils

Python client for the **vøiddo utilities API** at <https://data.voiddo.com>: deterministic tools for PDF (merge, split, text, info),
images and SVG, QR codes, HTML to PDF or image, Markdown, CSV / Excel / JSON / YAML conversion, JSON Schema validation, and
DNS / RDAP / IP / currency / holiday / ISO-code / time-zone lookups. One thin class on top of `requests`; no other dependencies.

## Install

The package is not on PyPI yet. Until it is, install the wheel the API serves (file names and checksums: <https://data.voiddo.com/sdk/>):

```bash
pip install https://data.voiddo.com/sdk/voiddo_utils-1.1.3-py3-none-any.whl
```

It is imported as `voiddo_utils`.

## Use

```python
from voiddo_utils import Client

client = Client()                     # free tier: 20 calls per day per IP. With a key: Client(api_key="vd_...") or env VOIDDO_API_KEY

png = client.call("qr_code", text="https://example.com")                  # bytes: tools that produce a file return bytes
open("qr.png", "wb").write(png)
country = client.call("iso_codes", type="country", query="IL")            # dict: tools that produce JSON return a dict
svg = client.qr_code(text="https://example.com", format="svg")            # every tool is also a typed, keyword-only method

# files go in as bytes, pathlib.Path, an open binary file, base64 / data: strings, or {"url": "https://..."}
from pathlib import Path
pages = client.pdf_text(file=Path("report.pdf"))
merged = client.pdf_merge(files=[Path("a.pdf"), Path("b.pdf")])

# inputs named like Python keywords get a trailing underscore: from_ is sent as "from"
yaml = client.json_yaml_convert(input='{"a": 1}', from_="json", to="yaml")

# run() returns the full Result: value, credits charged, balance, free calls left, metadata, request id
result = client.run("pdf_info", {"file": Path("report.pdf")})
print(result.data, result.credits_charged, result.balance, result.free_remaining)

client.wallet()          # balance and recent ledger rows (needs a key)
client.usage(days=7)     # calls and credits per day and tool (needs a key)
client.capabilities()    # the tool catalogue exactly as the API serves it
client.create_key()      # a new key, shown once, starting at 0 credits
```

## Money

* Without a key, 20 calls per day per client IP are free. After that, and whenever a key's balance is too low, the API answers
  HTTP 402 and the client raises `VoiddoPaymentRequired`; its `checkout_url` leads to the credit packs and `packs` lists them.
* Credits are prepaid: **$5 = 500**, **$9 = 1,000**, **$29 = 4,000**.
* The table below lists each tool's base price. A few tools (PDF merge, split and text on long documents, XLSX output) charge
  more for large jobs; `Result.credits_charged` is always the exact amount. A failed call is not charged credits (on the free tier
  it still uses one of the 20 daily calls).
* `screenshot` is free-tier only and is not sold through credits.

```python
from voiddo_utils import Client, VoiddoError, VoiddoPaymentRequired

try:
    Client().call("qr_code", text="hello")
except VoiddoPaymentRequired as e:
    print("buy credits:", e.checkout_url)           # e.packs lists the packs
except VoiddoError as e:
    print(e.status, e.message)                      # e.g. 400 invalid input at (root): 'query' is a required property
```

## Retries

Every call carries an `X-Request-Id`. With an API key the client re-sends after a connection error, HTTP 503 or a rate limit
(`max_retries`, default 2) and the API does not charge the same id twice (`Result.replayed`). Without a key a call is re-sent only
when the API says nothing ran (HTTP 503, rate limit), so a free-tier slot is never spent twice by accident.

## Tools

<!-- BEGIN GENERATED:tools -->
| Method | Tool | Credits | Returns |
| --- | --- | --- | --- |
| `csv_profile(...)` | CSV and Excel data profiler | 1 | `dict` |
| `currency_rates(...)` | Currency exchange rates (ECB) | 1 | `dict` |
| `dns_lookup(...)` | DNS record lookup | 1 | `dict` |
| `holidays_lookup(...)` | Public holidays lookup | 1 | `dict` |
| `html_to_image(...)` | HTML to image | 3 | `bytes` (image/png, image/jpeg, image/webp) |
| `html_to_pdf(...)` | HTML to PDF | 3 | `bytes` (application/pdf) |
| `image_convert(...)` | Image converter | 1 | `bytes` (image/png, image/jpeg, image/webp, image/gif, image/bmp, image/tiff, image/x-icon) |
| `ip_lookup(...)` | IP address lookup | 1 | `dict` |
| `iso_codes(...)` | ISO code lookup | 1 | `dict` |
| `json_schema_validate(...)` | JSON Schema validator | 1 | `dict` |
| `json_yaml_convert(...)` | JSON and YAML converter | 1 | `bytes` (application/json, application/yaml) |
| `kdp_preflight(...)` | KDP paperback file checker | 5 | `dict` |
| `kdp_puzzle_book(...)` | KDP puzzle book maker | 500 | `bytes` (application/zip) |
| `kdp_report(...)` | KDP check report lookup | free tier only | `dict` |
| `kdp_spine_calc(...)` | KDP cover size and spine width calculator | 1 | `dict` |
| `markdown_render(...)` | Markdown renderer | 1 | `bytes` (text/html, application/pdf) |
| `pdf_info(...)` | PDF info reader | 1 | `dict` |
| `pdf_merge(...)` | PDF merger | 1 | `bytes` (application/pdf) |
| `pdf_split(...)` | PDF splitter | 1 | `bytes` (application/pdf, application/zip) |
| `pdf_text(...)` | PDF text extractor | 1 | `dict` |
| `qr_code(...)` | QR code generator | 1 | `bytes` (image/png, image/svg+xml) |
| `rdap_lookup(...)` | RDAP registration lookup | 1 | `dict` |
| `screenshot(...)` | Website screenshot | free tier only | `bytes` (image/png, image/jpeg, image/webp) |
| `svg_to_png(...)` | SVG to PNG renderer | 1 | `bytes` (image/png) |
| `tabular_convert(...)` | CSV, TSV, Excel and JSON converter | 1 | `bytes` (text/csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/json) |
| `timezone_convert(...)` | Time zone converter | 1 | `dict` |
<!-- END GENERATED:tools -->

The same tools are available to agents over MCP at <https://data.voiddo.com/mcp> (streamable HTTP) and through the `voiddo-mcp`
stdio package; the API description is at <https://data.voiddo.com/openapi.json> and <https://data.voiddo.com/llms.txt>.

Support: data@voiddo.com. MIT licence.
