Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Nadeshiko SDK

Python SDK for the Nadeshiko API.

Install

pip install nadeshiko-sdk

Use the public SDK

The client sends your API key as Authorization: Bearer <apiKey>.

import os

from nadeshiko import Nadeshiko
from nadeshiko.api.search import search
from nadeshiko.models import Error, SearchRequest

client = Nadeshiko(
    base_url=os.getenv("NADESHIKO_BASE_URL", "https://api.nadeshiko.co"),
    token=os.getenv("NADESHIKO_API_KEY", "your-api-key"),
)

result = search.sync(
    client=client,
    body=SearchRequest(query="彼女"),
)

if isinstance(result, Error):
    print(result.code, result.detail)
else:
    for sentence in result.sentences:
        print(sentence.segment_info.content_jp)

Error handling

Every response returns either a typed response object or an Error. The Error object follows the RFC 7807 Problem Details format, so you always get a machine-readable code and a human-readable detail.

import os

from nadeshiko import Nadeshiko
from nadeshiko.api.search import search
from nadeshiko.models import Error, SearchRequest

client = Nadeshiko(
    base_url=os.getenv("NADESHIKO_BASE_URL", "https://api.nadeshiko.co"),
    token=os.getenv("NADESHIKO_API_KEY", "your-api-key"),
)

result = search.sync(
    client=client,
    body=SearchRequest(query="食べる"),
)

if isinstance(result, Error):
    match result.code:
        # 400 — Bad Request
        case "VALIDATION_FAILED":
            print("Validation failed:", result.detail)
        case "INVALID_JSON":
            print("Malformed JSON body:", result.detail)
        case "INVALID_REQUEST":
            print("Invalid request:", result.detail)

        # 401 — Unauthorized
        case "AUTH_CREDENTIALS_REQUIRED":
            print("Missing API key or session token")
        case "AUTH_CREDENTIALS_INVALID":
            print("API key is invalid")
        case "AUTH_CREDENTIALS_EXPIRED":
            print("Token has expired, re-authenticate")
        case "EMAIL_NOT_VERIFIED":
            print("Email verification required")

        # 403 — Forbidden
        case "ACCESS_DENIED":
            print("Access denied")
        case "INSUFFICIENT_PERMISSIONS":
            print("API key lacks the required scope")

        # 429 — Too Many Requests
        case "RATE_LIMIT_EXCEEDED":
            print("Rate limit hit, slow down")
        case "QUOTA_EXCEEDED":
            print("Monthly quota exhausted")

        # 500 — Internal Server Error
        case "INTERNAL_SERVER_EXCEPTION":
            print("Server error, trace ID:", result.instance)
else:
    for sentence in result.sentences:
        print(sentence.segment_info.content_jp, "—", sentence.basic_info.name_anime_en)

See examples/examples.py for more usage patterns.

Download files

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

Source Distribution

nadeshiko_internal_sdk-1.5.0.dev1773047764.tar.gz (101.3 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file nadeshiko_internal_sdk-1.5.0.dev1773047764.tar.gz.

File metadata

File hashes

Hashes for nadeshiko_internal_sdk-1.5.0.dev1773047764.tar.gz
Algorithm Hash digest
SHA256 d5c2f3aa557bcc2ef7700e922fc7a713f2e8f97c37037531e3b7fa0a61ad4bc7
MD5 0cf9e4d5173d1714648496572b10afa1
BLAKE2b-256 c8f95da95587dbf2799f684a9c778cbf20ad7b42f6cca657ccd801649bb80915

See more details on using hashes here.

Provenance

The following attestation bundles were made for nadeshiko_internal_sdk-1.5.0.dev1773047764.tar.gz:

Publisher: release.yml on BrigadaSOS/nadeshiko-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nadeshiko_internal_sdk-1.5.0.dev1773047764-py3-none-any.whl.

File metadata

File hashes

Hashes for nadeshiko_internal_sdk-1.5.0.dev1773047764-py3-none-any.whl
Algorithm Hash digest
SHA256 d84790bd4fcd32b80118c29395cc62967f96c0ace43919fb9218a27a38368dd1
MD5 29070259f2a3c6ec24fa354565eaabf2
BLAKE2b-256 bbb0485d900e3087ceff0c959a46e11ac32bd57620f4bb7a6865d658115b7650

See more details on using hashes here.

Provenance

The following attestation bundles were made for nadeshiko_internal_sdk-1.5.0.dev1773047764-py3-none-any.whl:

Publisher: release.yml on BrigadaSOS/nadeshiko-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

2.4.7

2 files

2.4.6

2 files

2.4.5

2 files

2.4.4

2 files

2.4.3

2 files

2.4.2

2 files

2.4.1

2 files

2.4.0

2 files

2.3.7

2 files

2.3.6

2 files

2.3.5

2 files

2.3.4

2 files

2.3.3

2 files

2.3.1

2 files

2.3.0

2 files

2.2.2

2 files

2.2.1

2 files

2.2.0

2 files

2.0.7

2 files

2.0.6

2 files

2.0.4

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

This release

1.5.0.dev1773047764 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page