API Python e Weblate-it

Instalim

The Python API is shipped separately, you need to install the Klient Weblate (wlc) to have it.

pip install wlc

wlc

WeblateException

exception wlc.WeblateException

Klasë bazë për krejt përjashtimet.

Weblate

class wlc.Weblate(key='', url=None, config=None, retries=0, status_forcelist=None, allowed_methods=None, backoff_factor=0, timeout=300)
Parametra:
  • key (str) – Kyç përdoruesi

  • url (str) – API server URL, if not specified default is used.

  • config (wlc.config.WeblateConfig) – Configuration object, overrides any other parameters.

  • 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.

Access class to the API, define API key and optionally API URL.

get(path)
Parametra:

path (str) – Shteg kërkese

Lloj kthimi:

object

Performs a single API GET call.

post(path, **kwargs)
Parametra:

path (str) – Shteg kërkese

Lloj kthimi:

object

Performs a single API GET call.

wlc.config

WeblateConfig

class wlc.config.WeblateConfig(section='wlc')
Parametra:

section (str) – Ndarje formësimi për t’u përdorur

Configuration file parser following XDG specification.

load(path=None)
Parametra:

path (str) – Path from which to load configuration.

Loads configuration from path when it is specified. Otherwise it loads the discovered global configuration file and then the nearest project configuration file (.weblate, .weblate.ini, or weblate.ini) from the current directory or its parents.

wlc.main

wlc.main.main(settings=None, stdout=None, args=None)
Parametra:
  • settings (list) – Settings to override as list of tuples

  • stdout (object) – stdout file object for printing output, uses sys.stdout as default

  • args (list) – Command-line arguments to process, uses sys.args as default

Main entry point for command-line interface.

@wlc.main.register_command(command)

Decorator to register Command class in main parser used by main().

Command

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

Main class for invoking commands.