autopush.config

Autopush Config Object and Setup

class autopush.config.AutopushConfig(debug=False, crypto_key=None, bear_hash_key=NOTHING, human_logs=True, hostname=None, port=None, resolve_hostname=False, router_scheme=None, router_hostname=None, router_port=None, endpoint_scheme=None, endpoint_hostname=None, endpoint_port=None, proxy_protocol_port=None, memusage_port=None, statsd_host='localhost', statsd_port=8125, megaphone_api_url=None, megaphone_api_token=None, megaphone_poll_interval=30, datadog_api_key=None, datadog_app_key=None, datadog_flush_interval=None, router_table={'tablename': 'router'}, message_table={'tablename': 'message'}, preflight_uaid='deadbeef00000000deadbeef00000000', ssl=NOTHING, router_ssl=NOTHING, client_certs=None, router_conf=NOTHING, connect_timeout=0.5, max_data=4096, env='development', ami_id=None, cors=False, hello_timeout=0, msg_limit=100, auto_ping_interval=None, auto_ping_timeout=None, max_connections=None, close_handshake_timeout=None, notification_legacy=False, use_cryptography=False, sts_max_age=31536000, no_sslcontext_cache=False, aws_ddb_endpoint=None, allow_table_rotation=True)[source]

Main Autopush Settings Object

enable_tls_auth

Whether TLS authentication w/ client certs is enabled

classmethod from_argparse(ns, **kwargs)[source]

Create an instance from argparse/additional kwargs

make_endpoint(uaid, chid, key=None)[source]

Create an v1 or v2 WebPush endpoint from the identifiers.

Both endpoints use bytes instead of hex to reduce ID length. v1 is the uaid + chid v2 is the uaid + chid + sha256(key).bytes

Parameters:
  • uaid – User Agent Identifier
  • chid – Channel or Subscription ID
  • key – Optional Base64 URL-encoded application server key
Returns:

Push endpoint

parse_endpoint(metrics, token, version='v1', ckey_header=None, auth_header=None)[source]

Parse an endpoint into component elements of UAID, CHID and optional key hash if v2

Parameters:
  • token – The obscured subscription data.
  • version – This is the API version of the token.
  • ckey_header – the Crypto-Key header bearing the public key (from Crypto-Key: p256ecdsa=)
  • auth_header – The Authorization header bearing the VAPID info
Raises:

ValueError – In the case of a malformed endpoint.

Returns:

a dict containing (uaid=UAID, chid=CHID, public_key=KEY)

__init__(debug=False, crypto_key=None, bear_hash_key=NOTHING, human_logs=True, hostname=None, port=None, resolve_hostname=False, router_scheme=None, router_hostname=None, router_port=None, endpoint_scheme=None, endpoint_hostname=None, endpoint_port=None, proxy_protocol_port=None, memusage_port=None, statsd_host='localhost', statsd_port=8125, megaphone_api_url=None, megaphone_api_token=None, megaphone_poll_interval=30, datadog_api_key=None, datadog_app_key=None, datadog_flush_interval=None, router_table={'tablename': 'router'}, message_table={'tablename': 'message'}, preflight_uaid='deadbeef00000000deadbeef00000000', ssl=NOTHING, router_ssl=NOTHING, client_certs=None, router_conf=NOTHING, connect_timeout=0.5, max_data=4096, env='development', ami_id=None, cors=False, hello_timeout=0, msg_limit=100, auto_ping_interval=None, auto_ping_timeout=None, max_connections=None, close_handshake_timeout=None, notification_legacy=False, use_cryptography=False, sts_max_age=31536000, no_sslcontext_cache=False, aws_ddb_endpoint=None, allow_table_rotation=True)

x.__init__(…) initializes x; see help(type(x)) for signature

class autopush.config.SSLConfig(key=None, cert=None, dh_param=None)[source]

AutopushSSLContextFactory configuration

cf(**kwargs)[source]

Build our AutopushSSLContextFactory (if configured)

class autopush.config.DDBTableConfig(tablename, read_throughput=5, write_throughput=5)[source]

A DynamoDB Table’s configuration