Weblate の Python API¶
インストール¶
Python API は標準では入っていません。使用するには Weblate クライアント (wlc)をインストールしてください。
pip install wlc
wlc¶
WeblateException¶
- exception wlc.WeblateException¶
すべての例外の基底クラス。
Weblate¶
- class wlc.Weblate(key='', url=None, config=None, retries=0, status_forcelist=None, allowed_methods=None, backoff_factor=0, timeout=300)¶
- パラメータ:
key (str) -- ユーザー key
url (str) -- API サーバーの URL、指定がなければデフォルトが使用される。
config (wlc.config.WeblateConfig) -- 設定オブジェクト、他のパラメータを上書きする。
retries (int) -- Total number of HTTP retries.
status_forcelist (list) -- HTTP status codes that should trigger retries.
allowed_methods (list) -- HTTP methods that may be retried.
backoff_factor (float) -- Retry backoff factor passed to urllib3.
timeout (int) -- HTTP request timeout in seconds.
API へのアクセス クラスに、API キーと必要なら API URL を設定します。
- get(path)¶
- パラメータ:
path (str) -- リクエストのパス
- 戻り値の型:
object
単体の API GET 呼び出しを実行します。
- post(path, **kwargs)¶
- パラメータ:
path (str) -- リクエストのパス
- 戻り値の型:
object
単体の API GET 呼び出しを実行します。
wlc.config¶
WeblateConfig¶
- class wlc.config.WeblateConfig(section='wlc')¶
- パラメータ:
section (str) -- 使用するセクションの設定
XDG 仕様に準拠した設定ファイルのパーサー。
- load(path=None)¶
- パラメータ:
path (str) -- 設定の読み込み元のパス。
Loads configuration from
pathwhen it is specified. Otherwise it loads the discovered global configuration file and then the nearest project configuration file (.weblate,.weblate.ini, orweblate.ini) from the current directory or its parents.
wlc.main¶
- wlc.main.main(settings=None, stdout=None, args=None)¶
- パラメータ:
settings (list) -- タプルのリストとして上書きする設定
stdout (object) -- 出力表示用の stdout ファイル オブジェクト。デフォルトで
sys.stdoutを使用するargs (list) -- 処理用のコマンドライン引数。デフォルトで
sys.argsを使用する
コマンドライン インターフェイスのメイン エントリ ポイント。
Command¶
- class wlc.main.Command(args, config, stdout=None)¶
コマンドを呼び出すためのメイン クラス。