Python client for the Nextrows Open API.
Project description
nextrows-py
Python client for the Nextrows Open API.
Getting Started
API Key
To use this client, you need a NextRows API key. Create one at:
NextRows Dashboard: https://nextrows.com/dashboard/overview
Documentation
API docs: https://nextrows.com/docs/api
Installation
pip install nextrows-py
Development (uv)
uv venv
uv pip install -e ".[test]"
uv run pytest
Quick Start
from nextrows import Nextrows
client = Nextrows(api_key="sk-nr-your-api-key")
API Methods
Extract Data
result = client.extract(
{
"type": "url",
"data": ["https://example.com/products"],
"prompt": "Extract all product names and prices",
}
)
if result["success"]:
print(result.get("data"))
Using Pydantic Schema (Optional)
Install pydantic and pass a model or schema object. The client converts it to JSON Schema.
pip install "nextrows-py[schema]"
from pydantic import BaseModel
from nextrows import Nextrows
class Product(BaseModel):
name: str
price: float
client = Nextrows(api_key="sk-nr-your-api-key")
result = client.extract(
{
"type": "text",
"data": ["Product A costs $10, Product B costs $20"],
"schema": Product,
}
)
Async Client
pip install \"nextrows-py[async]\"
import asyncio
from nextrows import AsyncNextrows
async def main() -> None:
async with AsyncNextrows(api_key=\"sk-nr-your-api-key\") as client:
result = await client.get_credits()
print(result)
asyncio.run(main())
Run App (JSON)
result = client.run_app_json(
{
"appId": "abc123xyz",
"inputs": [
{"key": "url", "value": "https://example.com/products"},
{"key": "maxItems", "value": 10},
],
}
)
if result["success"] and result.get("data"):
for row in result["data"]:
print(row)
Run App (Table)
result = client.run_app_table(
{
"appId": "abc123xyz",
"inputs": [{"key": "url", "value": "https://example.com/products"}],
}
)
if result["success"] and result.get("data"):
print(result["data"]["columns"])
for row in result["data"]["tableData"]:
print(row)
Get Credits
result = client.get_credits()
if result["success"] and result.get("data"):
print(f"Remaining credits: {result['data']['credits']}")
Configuration
client = Nextrows(
api_key="sk-nr-your-api-key",
base_url="https://api.nextrows.com",
timeout=30.0,
)
Notes
timeoutis in seconds (float), default 30s.schemaaccepts a JSON Schema dict or a Pydantic model/class with schema methods.
Project details
Release history Release notifications | RSS feed
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 nextrows_py-0.1.0.tar.gz.
File metadata
- Download URL: nextrows_py-0.1.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
638fe000d132a73169dbb3069c6c14bc479f6f8a54961f2e16f938f28aa86077
|
|
| MD5 |
df570728e7461f6dbed0380b042067b4
|
|
| BLAKE2b-256 |
430266590f20a3cdeeac1eb87f10df4e10407960429efd7ef89cd78908ac3bd6
|
File details
Details for the file nextrows_py-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nextrows_py-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b3f741c704c27024fbaeb500336b1717ffdbcb8a802d0b6e9a2d3c585d35758
|
|
| MD5 |
c3ac7f94bef555c1692c89b6c81022d6
|
|
| BLAKE2b-256 |
35677d1b6a438065fde96b82ba071737552912e5581e5cc940bd174eca154b6e
|