Attention

This is the documentation for HARP Proxy, actually published as an early preview. Both the software and documentation are a work in progress, and although we already use it on various production servers, they may contain inaccuracies, typographical errors, huge mistakes and empty pages. We work hard to eradicate all mistakes and implement stuff, but it is a long and tedious process. We appreciate your patience and understanding. Of course, any help will be greatly appreciated.

Core (harp)

The Core (harp) package is the root namespace of the Harp framework.

It mostly contains a reference to the Config class, because it’s the only object you need to start using Harp using the python API (you don’t need to use this API, configuration files should be enough for most use cases, but if you want to, this is the starting point).

For convenience, the run() function is also available, which is a simple way to start the default server implementation for your configuration object.

Example usage:

from harp import Config, run

config = Config()
config.add_defaults()

if __name__ == "__main__":
    run(config)

You can find more information about how configuration works in the harp.config module.

Contents

class Config[source]

Bases: object

__init__(settings=None, /, applications=None)[source]
add_application(name, /, *, debug=False)[source]
add_defaults()[source]
classmethod deserialize(settings)[source]
get_application_type(name)[source]
Parameters:

name (str)

Return type:

Type[Application]

read_env(options, /)[source]

Parses sys.argv-like arguments.

Parameters:
  • args

  • files – list of filenames to load in order. Will happen after defaults env and files.

  • options (CommonServerOptions)

Returns:

argparse.Namespace

register_events(dispatcher)[source]
Parameters:

dispatcher (IAsyncEventDispatcher)

register_services(container)[source]
Parameters:

container (Container)

remove_application(name)[source]
reset()[source]
serialize()[source]
set(key, value)[source]
validate(*, allow_extraneous_settings=False, secure=False)[source]
DEFAULT_APPLICATIONS = ['http_client', 'proxy', 'dashboard', 'sqlalchemy_storage', 'telemetry', 'janitor', 'harp_apps.contrib.sentry']
property applications
property settings
get_logger(name, *args, **initial_values)[source]
Parameters:
  • args (Any)

  • initial_values (Any)

Return type:

Any

run(config)[source]

Run the default server using provided configuration.

Parameters:

config (Config) – Config

Returns:

Submodules