Weblate の Python API

導入

The Python API is shipped separately, you need to install the Weblate クライアント (wlc) to have it.

pip install wlc

wlc

WeblateException

exception wlc.WeblateException

すべての例外の基底クラス。

Weblate

class wlc.Weblate(key='', url=None, config=None)
パラメータ
  • key (str) -- ユーザー key

  • url (str) -- API サーバーの URL、指定がなければデフォルトが使用される

  • config (wlc.config.WeblateConfig) -- 設定オブジェクト、他のパラメータを上書きする。

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) -- 設定の読み込み元のパス。

設定をファイルから読み込みます。設定の指定がない場合は、XDG 設定パス(/etc/xdg/wlc )に配置された wlc 設定ファイル(~/.config/wlc )から読み込みます。

wlc.main

wlc.main.main(settings=None, stdout=None, args=None)
パラメータ
  • settings (list) -- タプルのリストとして上書きする設定

  • stdout (object) -- 印刷用の stdout ファイル オブジェクト。デフォルトで sys.stdout を使用する

  • args (list) -- 処理用のコマンドライン引数。デフォルトで sys.args を使用する

コマンド ライン インターフェイスのメイン エントリ ポイント。

@wlc.main.register_command(command)

main() で使用するメイン パーサーに、main() クラスを登録するデコレータ。

Command

class wlc.main.Command(args, config, stdout=None)

コマンドを呼び出すためのメイン クラス。