Python SDK for Nadeshiko API (internal build - includes internal endpoints)
Project description
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.
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 nadeshiko_internal_sdk-1.5.0.dev1772111014.tar.gz.
File metadata
- Download URL: nadeshiko_internal_sdk-1.5.0.dev1772111014.tar.gz
- Upload date:
- Size: 93.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b970d00c728fe6d13dccc2d332e95e0fc64fcaaba532c695a0acaab9f2586b4
|
|
| MD5 |
aa7b4afc88ddf44b3b3b87053b8e8cae
|
|
| BLAKE2b-256 |
b689dbd6a4dbd055de7a5305b7309b1e0fb498317d1fa5151dd1d3b203552804
|
Provenance
The following attestation bundles were made for nadeshiko_internal_sdk-1.5.0.dev1772111014.tar.gz:
Publisher:
release.yml on BrigadaSOS/nadeshiko-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nadeshiko_internal_sdk-1.5.0.dev1772111014.tar.gz -
Subject digest:
2b970d00c728fe6d13dccc2d332e95e0fc64fcaaba532c695a0acaab9f2586b4 - Sigstore transparency entry: 996822374
- Sigstore integration time:
-
Permalink:
BrigadaSOS/nadeshiko-sdk-python@e73af90307699f85a64c1f6b47ce5953253e5c22 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/BrigadaSOS
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e73af90307699f85a64c1f6b47ce5953253e5c22 -
Trigger Event:
repository_dispatch
-
Statement type:
File details
Details for the file nadeshiko_internal_sdk-1.5.0.dev1772111014-py3-none-any.whl.
File metadata
- Download URL: nadeshiko_internal_sdk-1.5.0.dev1772111014-py3-none-any.whl
- Upload date:
- Size: 329.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b52a133433635c7ef84825e102969718dc35a20d99c131f34fb51313e33b279e
|
|
| MD5 |
75f73599a356b44827aef53192e43eca
|
|
| BLAKE2b-256 |
7efcf4b81b8040ce072e652fdfc35f987cb41c7e90616167d91f1e66a4452d1e
|
Provenance
The following attestation bundles were made for nadeshiko_internal_sdk-1.5.0.dev1772111014-py3-none-any.whl:
Publisher:
release.yml on BrigadaSOS/nadeshiko-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nadeshiko_internal_sdk-1.5.0.dev1772111014-py3-none-any.whl -
Subject digest:
b52a133433635c7ef84825e102969718dc35a20d99c131f34fb51313e33b279e - Sigstore transparency entry: 996822455
- Sigstore integration time:
-
Permalink:
BrigadaSOS/nadeshiko-sdk-python@e73af90307699f85a64c1f6b47ce5953253e5c22 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/BrigadaSOS
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e73af90307699f85a64c1f6b47ce5953253e5c22 -
Trigger Event:
repository_dispatch
-
Statement type: