Skip to content

Latest commit

 

History

History
118 lines (75 loc) · 2.51 KB

python.rst

File metadata and controls

118 lines (75 loc) · 2.51 KB

single: Python single: API

Weblate's Python API

Installation

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

pip install wlc

wlc

wlc

WeblateException

WeblateException

Base class for all exceptions.

Weblate

param key

User key

type key

str

param url

API server URL, if not specified default is used

type url

str

param config

Configuration object, overrides any other parameters.

type config

wlc.config.WeblateConfig

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

get(path)

param path

Request path

type path

str

rtype

object

Performs a single API GET call.

post(path, **kwargs)

param path

Request path

type path

str

rtype

object

Performs a single API GET call.

wlc.config

wlc.config

WeblateConfig

param section

Configuration section to use

type section

str

Configuration file parser following XDG specification.

load(path=None)

param path

Path from which to load configuration.

type path

str

Loads configuration from a file, if none is specified, it loads from the wlc configuration file (~/.config/wlc) placed in your XDG configuration path (/etc/xdg/wlc).

wlc.main

wlc.main

main(settings=None, stdout=None, args=None)

param settings

Settings to override as list of tuples

type settings

list

param stdout

stdout file object for printing output, uses sys.stdout as default

type stdout

object

param args

Command-line arguments to process, uses sys.args as default

type args

list

Main entry point for command-line interface.

register_command(command)

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

Command

Main class for invoking commands.