Skip to content

Latest commit

 

History

History

python

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

initiable

Official Python SDK and CLI for the Initiable API.

Initiable Ventures LLP is a technology and business consultancy in Noida (Delhi NCR) and San Francisco. The API is public and keyless: read the company profile, services and FAQ, and send a project inquiry.

  • Standard library only (urllib). No dependencies.
  • Python 3.9 or later. Typed (py.typed).

Install

pip install initiable

SDK

from initiable import Initiable, InitiableError

client = Initiable()  # Initiable(base_url=None, *, timeout=30.0, user_agent=None, transport=None)

company = client.company.get()
page = client.services.list(limit=10)  # {"data": [...], "has_more": bool, "next_cursor": str | None}
for service in client.services.list_all():
    print(service["id"], service["name"])
ml = client.services.get("machine-learning")
faq = client.faq.list()["data"]

# Validate an inquiry without sending it.
check = client.inquiries.create(
    name="Ada Lovelace",
    email="ada@example.com",
    message="We need an iOS app for our clinic.",
    services=["mobile-application"],
    budget="$5000 to $10000",
    dry_run=True,
)
print(check["status"])  # "validated"

inquiries.create takes the fields as keyword arguments, as a dict (create({...}, dry_run=True)), or both. Without dry_run=True it sends a real inquiry to a person at Initiable and returns {"id": ..., "status": "received"}. Confirm with the user first.

Each call sends an Idempotency-Key header. If you do not pass idempotency_key, a random UUID is used. To retry safely after a network error, pass the same key again:

import uuid
key = str(uuid.uuid4())
client.inquiries.create(inquiry, idempotency_key=key)

Responses are plain dicts. TypedDict definitions (Service, Company, InquiryResult, ...) are exported for type checkers.

Errors

Non-2xx responses raise InitiableError:

try:
    client.inquiries.create(name="A", email="bad", message="short", dry_run=True)
except InitiableError as err:
    err.status       # 422
    err.code         # "validation_failed"
    err.detail       # "The request body has 2 invalid fields."
    err.errors       # [{"field": "email", "message": "Must be a valid email address."}, ...]
    err.retry_after  # seconds, set on 429

Network failures raise urllib.error.URLError (an OSError).

CLI

initiable services
initiable service machine-learning
initiable company
initiable faq
initiable inquire --name "Ada Lovelace" --email ada@example.com \
  --message "We need an iOS app for our clinic." \
  --services mobile-application --budget '$5000 to $10000' --dry-run

python -m initiable works too. Add --json for raw JSON. --base-url (or INITIABLE_BASE_URL) points the CLI at another server. Run initiable --help for every option.

Exit codes: 0 success, 1 API or network error, 2 usage error.

Links

MIT licensed.