flaretool.ddns package¶
Submodules¶
flaretool.ddns.DdnsService module¶
Service class for Dynamic DNS (DDNS) functionality.
- class flaretool.ddns.DdnsService.DdnsService¶
Bases:
objectService class for Dynamic DNS (DDNS) functionality.
Warning
This class may undergo updates and its usage may change in the near future.
- update_ddns(host: str, ip: str | None = None) DdnsInfo¶
Update the Dynamic DNS (DDNS) for the specified host.
- Parameters:
host (str) – The host to update the DDNS for.
ip (str, optional) – The IP address to set for the host. If not provided, the current IP will be used.
- Returns:
The updated DDNS information.
- Return type:
- Raises:
DdnsAuthenticationError – If the response code is 401.
DdnsError – If the response code is not 200.
Example
>>> service = DdnsService() >>> info = service.update_ddns("example", "192.168.0.100") >>> print(info) DdnsInfo(result=200, status='success', currentIp='192.168.0.99', updateIp='192.168.0.100', domain='example.○○○.○○')
flaretool.ddns.aio module¶
DDNSサービスの非同期版クライアント。
同期版 DdnsService の各メソッドを
asyncio.to_thread でワーカースレッドに委譲する薄いラッパーです。
イベントループをブロックせずにDDNS APIを利用できます。
Warning
このクラスは更新される可能性があり、近い将来使用方法が変更される場合があります。
- class flaretool.ddns.aio.AsyncDdnsService(_service: DdnsService | None = None)¶
Bases:
objectダイナミックDNS(DDNS)サービスの非同期版クラス。
同期版
DdnsServiceをラップし、各メソッドをasyncio.to_thread経由で実行します。 非同期コンテキストマネージャー(async with)としても利用できます。Examples
>>> async with AsyncDdnsService() as svc: ... info = await svc.update_ddns("example", "192.168.0.100") ... print(info.domain)
- async update_ddns(host: str, ip: str | None = None) DdnsInfo¶
非同期版: 指定したホストのダイナミックDNS(DDNS)を更新する。
- Parameters:
host (str) – DDNSを更新するホスト名。
ip (str | None) – 設定するIPアドレス。省略時は現在のIPが使用されます。
- Returns:
更新されたDDNSの情報。
- Return type:
Examples
>>> async with AsyncDdnsService() as svc: ... info = await svc.update_ddns("example", "192.168.0.100")
flaretool.ddns.errors module¶
Errors raised by the DDNS service.
- exception flaretool.ddns.errors.DdnsAuthenticationError(status: str = '', result: int | None = None, currentIp: str | None = None, updateIp: str | None = None, domain: str | None = None)¶
Bases:
DdnsError
- exception flaretool.ddns.errors.DdnsError(status: str = '', result: int | None = None, currentIp: str | None = None, updateIp: str | None = None, domain: str | None = None)¶
Bases:
FlareToolErrorBase error for the DDNS service.
All fields default to
None/empty so the error is constructible with just a message:DdnsError("something went wrong"). Note that the message (status) comes first; API responses are unpacked with keyword arguments (DdnsError(**result)) and are unaffected.
flaretool.ddns.models module¶
Data models for the DDNS service.
- class flaretool.ddns.models.DdnsInfo(*, result: int, status: str, currentIp: str | None = None, updateIp: str, domain: str)¶
Bases:
BaseDataModelRepresents the Dynamic DNS (DDNS) information.
- result¶
The result code of the DDNS update.
- Type:
int
- status¶
The status of the DDNS update.
- Type:
str
- currentIp¶
The current IP address associated with the domain.
- Type:
str | None
- updateIp¶
The IP address that was updated.
- Type:
str
- domain¶
The domain associated with the DDNS update.
- Type:
str
- currentIp: str | None¶
- domain: str¶
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- result: int¶
- status: str¶
- updateIp: str¶
Module contents¶
- class flaretool.ddns.AsyncDdnsService(_service: DdnsService | None = None)¶
Bases:
objectダイナミックDNS(DDNS)サービスの非同期版クラス。
同期版
DdnsServiceをラップし、各メソッドをasyncio.to_thread経由で実行します。 非同期コンテキストマネージャー(async with)としても利用できます。Examples
>>> async with AsyncDdnsService() as svc: ... info = await svc.update_ddns("example", "192.168.0.100") ... print(info.domain)
- async update_ddns(host: str, ip: str | None = None) DdnsInfo¶
非同期版: 指定したホストのダイナミックDNS(DDNS)を更新する。
- Parameters:
host (str) – DDNSを更新するホスト名。
ip (str | None) – 設定するIPアドレス。省略時は現在のIPが使用されます。
- Returns:
更新されたDDNSの情報。
- Return type:
Examples
>>> async with AsyncDdnsService() as svc: ... info = await svc.update_ddns("example", "192.168.0.100")
- class flaretool.ddns.DdnsService¶
Bases:
objectService class for Dynamic DNS (DDNS) functionality.
Warning
This class may undergo updates and its usage may change in the near future.
- update_ddns(host: str, ip: str | None = None) DdnsInfo¶
Update the Dynamic DNS (DDNS) for the specified host.
- Parameters:
host (str) – The host to update the DDNS for.
ip (str, optional) – The IP address to set for the host. If not provided, the current IP will be used.
- Returns:
The updated DDNS information.
- Return type:
- Raises:
DdnsAuthenticationError – If the response code is 401.
DdnsError – If the response code is not 200.
Example
>>> service = DdnsService() >>> info = service.update_ddns("example", "192.168.0.100") >>> print(info) DdnsInfo(result=200, status='success', currentIp='192.168.0.99', updateIp='192.168.0.100', domain='example.○○○.○○')