Skip to main content

ada-diamonds

Official Python client for the Ada Diamonds API: live lab grown diamond inventory, engagement ring settings, fine jewelry, and diamond buying guides.

Pure Python, no dependencies beyond the standard library. Python 3.9 or newer.

Install

pip install ada-diamonds

Publishing to PyPI is pending. Until the release lands, install from the repository:

pip install "git+https://github.com/adadiamonds/ada-diamonds-nextjs.git#subdirectory=packages/ada-python"

Reading the catalog needs no account and no API key.

Examples

Search live diamond inventory

from ada_diamonds import Client

client = Client()  # anonymous, 120 requests per minute
page = client.diamonds(shape="Oval", min_carat=1, max_price=4000, sort="price_asc")
for stone in page["data"]:
    print(stone["carat"], stone["shape"], stone["color"], stone["clarity"], stone["price"])
print(page["pagination"])      # {'total': ..., 'limit': 25, 'offset': 0, 'has_more': ...}
print(client.last_rate_limit)  # RateLimit({'limit': 120, 'remaining': 119, 'reset': 58, ...})

Quote a complete engagement ring

An engagement ring is a setting plus a loose diamond, priced separately. price_from on a setting excludes the center stone. All prices are US dollars.

setting = client.engagement_rings(shape="Oval", type="Solitaire", limit=1)["data"][0]
stone = client.diamonds(shape="Oval", min_carat=1.5, max_carat=1.6, sort="price_asc", limit=1)["data"][0]
print(setting["name"], "+", stone["carat"], "ct =", setting["price_from"] + stone["price"])

Get a key, then write

from ada_diamonds import AdaApiError, Client

issued = Client().create_key("my-agent", env="sandbox")   # no account needed
client = Client(api_key=issued["api_key"])                  # 600 requests per minute

try:
    result = client.request_consultation(
        {"email": "test@example.com", "topic": "engagement_ring"},
        idempotency_key="consult-0001",
    )
    print(result)  # sandbox keys return {"sandbox": true, ...} and contact nobody
except AdaApiError as exc:
    print(exc.status, exc.error, exc.error_description, exc.documentation_url)

Methods

Method Endpoint
diamonds(**filters) GET /api/v1/diamonds
diamond(id) GET /api/v1/diamonds/{id}
engagement_rings(**filters) GET /api/v1/engagement-rings
engagement_ring(slug) GET /api/v1/engagement-rings/{slug}
jewelry(**filters) GET /api/v1/jewelry
jewelry_item(slug) GET /api/v1/jewelry/{slug}
knowledge_base(q=None) GET /api/v1/knowledge-base
article(slug) GET /api/v1/knowledge-base/{slug}
showrooms() GET /api/v1/showrooms
request_consultation(payload, idempotency_key=None) POST /api/v1/consultations
create_key(name, env="sandbox") POST /api/v1/keys
batch(requests) POST /api/v1/batch
ask(query) GET /ask (NLWeb)
request(method, path, params=None, body=None, headers=None) any endpoint

Errors raise AdaApiError with status, error, error_description, documentation_url, and retry_after_seconds (on 429). After every call client.last_rate_limit holds the RateLimit-* headers and client.last_headers the full header map.

Pass base_url= to point at another host, for example a preview deployment.

Also available

Support

Developer questions: it@adadiamonds.com. Automated bulk scraping of the site is not permitted; this API is the supported way to read the catalog.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ada_diamonds-1.0.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ada_diamonds-1.0.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file ada_diamonds-1.0.0.tar.gz.

File metadata

  • Download URL: ada_diamonds-1.0.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.0

File hashes

Hashes for ada_diamonds-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a8c93a1d99eb650449cae09aab3e903b01c8780a272df13a37805f942d8904d6
MD5 642ed56f645166fb3e5236b45f18b63b
BLAKE2b-256 c7bcb7f0519b19a5ff9876b5125bba4ea760f89a14ab4a94ccb1a47de4ae7dd3

See more details on using hashes here.

File details

Details for the file ada_diamonds-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ada_diamonds-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.0

File hashes

Hashes for ada_diamonds-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 748a984ac74ba08596a32251a91cfb96d7469f9c371fb1d7d160463c8492e5e4
MD5 9df07c4c24cfe6d906728f4d9a7fae79
BLAKE2b-256 8b46fc15e8bcff900cbb5322a6e8496110720ca4e21b3093b5711f0bda485a3c

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.1

2 files

This release

1.0.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page