pgflux.output package

Submodules

pgflux.output.http module

class pgflux.output.http.HTTPOutput

Bases: pgflux.output.interface.Output

CLI_HELP = 'Sends a bulk HTTP POST request to InfluxDB'
CONNECTION_CLASS

alias of http.client.HTTPConnection

ENV_VARS = {'PGFLUX_INFLUX_DBNAME': 'The database name', 'PGFLUX_INFLUX_HOST': 'Hostname of the InfluxDB', 'PGFLUX_INFLUX_PASSWORD': 'The password', 'PGFLUX_INFLUX_USERNAME': 'The username'}
NAME = 'http'
PRECISION: pgflux.enums.Precision = 0
connect() Generator[Tuple[http.client.HTTPConnection, Dict[str, str], Dict[str, str]], None, None]

Create a new InfluxDB connection using the PGFLUX_INFLUX_* environment variables.

The variables are also loaded from a .env file in the current working folder if it exists.

flush() None
send(row: str) None
class pgflux.output.http.HTTPSOutput

Bases: pgflux.output.http.HTTPOutput

CONNECTION_CLASS

alias of http.client.HTTPSConnection

NAME = 'https'
lines: List[str]
pgflux.output.http.send_to_influx(connection: http.client.HTTPConnection, headers: Dict[str, str], params: Dict[str, str], payload: str) http.client.HTTPResponse

Send the data in payload to InfluxDB using connection.

This sends a simple HTTP POST request to the other end of connection.

Parameters
  • connection – The HTTP connection to the InfluxDB endpoint

  • headers – An optional mapping for HTTP headers

  • param – An optional mapping for HTTP query arguments

  • payload – The data to send

Returns

A HTTP response

pgflux.output.interface module

class pgflux.output.interface.Output

Bases: abc.ABC

PRECISION: pgflux.enums.Precision = 9
REGISTRY: Dict[str, Type[pgflux.output.interface.Output]] = {'http': <class 'pgflux.output.http.HTTPOutput'>, 'https': <class 'pgflux.output.http.HTTPSOutput'>, 'stdout': <class 'pgflux.output.stream.StreamOutput'>}
static create(output_name: str) pgflux.output.interface.Output
abstract flush() None
abstract send(row: str) None

pgflux.output.stream module

class pgflux.output.stream.StreamOutput

Bases: pgflux.output.interface.Output

CLI_HELP = 'Writes all measurements onto stdout'
NAME = 'stdout'
STREAM: TextIO = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
flush() None
send(row: str) None

Module contents

class pgflux.output.HTTPOutput

Bases: pgflux.output.interface.Output

CLI_HELP = 'Sends a bulk HTTP POST request to InfluxDB'
CONNECTION_CLASS

alias of http.client.HTTPConnection

ENV_VARS = {'PGFLUX_INFLUX_DBNAME': 'The database name', 'PGFLUX_INFLUX_HOST': 'Hostname of the InfluxDB', 'PGFLUX_INFLUX_PASSWORD': 'The password', 'PGFLUX_INFLUX_USERNAME': 'The username'}
NAME = 'http'
PRECISION: pgflux.enums.Precision = 0
connect() Generator[Tuple[http.client.HTTPConnection, Dict[str, str], Dict[str, str]], None, None]

Create a new InfluxDB connection using the PGFLUX_INFLUX_* environment variables.

The variables are also loaded from a .env file in the current working folder if it exists.

flush() None
lines: List[str]
send(row: str) None
class pgflux.output.HTTPSOutput

Bases: pgflux.output.http.HTTPOutput

CONNECTION_CLASS

alias of http.client.HTTPSConnection

NAME = 'https'
lines: List[str]
class pgflux.output.Output

Bases: abc.ABC

PRECISION: pgflux.enums.Precision = 9
REGISTRY: Dict[str, Type[pgflux.output.interface.Output]] = {'http': <class 'pgflux.output.http.HTTPOutput'>, 'https': <class 'pgflux.output.http.HTTPSOutput'>, 'stdout': <class 'pgflux.output.stream.StreamOutput'>}
static create(output_name: str) pgflux.output.interface.Output
abstract flush() None
abstract send(row: str) None
class pgflux.output.StreamOutput

Bases: pgflux.output.interface.Output

CLI_HELP = 'Writes all measurements onto stdout'
NAME = 'stdout'
STREAM: TextIO = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
flush() None
send(row: str) None