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) – User key

  • url (str) – API Server URL,如果沒有指定預設值

  • config (wlc.config.WeblateConfig) – 配置對象,覆蓋任何其他參數。

訪問API的類,定義API鍵和可選的API URL。

get(path)
參數:

path (str) – Request path

回傳型別:

object

執行單個API呼叫。

post(path, **kwargs)
參數:

path (str) – Request path

回傳型別:

object

執行單個API呼叫。

wlc.config

WeblateConfig

class wlc.config.WeblateConfig(section='wlc')
參數:

section (str) – Configuration section to use

XDG規範之後的配置文件解析器。

load(path=None)
參數:

path (str) – 從中加載配置的路徑。

從文件中加載配置,如果沒有指定,則從“WLC”配置文件(:“文件:〜/ .config / wlc)中加載(:file:/ etc / xdg / 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)

註冊 Command`裝飾器類別在主要解析程式 :func:`main 中。

Command

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

用於調用命令的主類。