Getting Started¶
Installation¶
Authentication¶
Use an API token or API key:
Service Selection¶
service accepts either a predefined enum or a custom ORPC origin URL:
from aimage import search
from aimage.search.settings import SearchService
client = search.client(service=SearchService.PROD)
client = search.client(service=SearchService.DEV)
client = search.client(service="https://custom-api.example.com")
SearchClient also accepts service directly:
from aimage.search.client import SearchClient
from aimage.search.settings import SearchService
client = SearchClient(service=SearchService.DEV)
Email Login¶
Entering the context sends an email code. Call code() after the user enters it:
from aimage.search.client import SearchClient
client = SearchClient(service="https://api.search.ai-mage.jp")
with client.login_with_email(email="[email protected]") as login:
code = input("email code> ")
result = login.code(code)
If MFA is required, continue with TOTP:
with client.login_with_email(email="[email protected]") as login:
login.code(input("email code> "))
result = login.totp(input("totp> "))