simpledali.util

Module Contents

Functions

datetimeToHPTime

Convert a datatime.datetime to a datalink hptime

hptimeToDatetime

Convert a datalink hptime to a datatime.datetime

utcnowWithTz

Create a datetime to the current time with the timezone set to utc.

isowithz

A ISO8601 string for the given datatime, but with the timezone set to Z instead of +00:00

hptimeAsIso

Convert an hptime into an ISO8601 string with Z timezone

optional_date

prettyPrintInfo

encodeAuthToken

Note token auth is not part of ringserver proper, uses a fork I created.

decodeAuthToken

Note token auth is not part of ringserver proper, uses a fork I created.

timeUntilExpireToken

Note token auth is not part of ringserver proper, uses a fork I created.

Data

MICROS

INFO_VERSION

INFO_SERVERID

INFO_CAPABILITIES

INFO_STATUS

INFO_STREAMLIST

INFO_STREAM

API

simpledali.util.MICROS = 1000000
simpledali.util.datetimeToHPTime(time)

Convert a datatime.datetime to a datalink hptime

simpledali.util.hptimeToDatetime(hptime)

Convert a datalink hptime to a datatime.datetime

simpledali.util.utcnowWithTz()

Create a datetime to the current time with the timezone set to utc.

simpledali.util.isowithz(dt)

A ISO8601 string for the given datatime, but with the timezone set to Z instead of +00:00

simpledali.util.hptimeAsIso(hptime)

Convert an hptime into an ISO8601 string with Z timezone

simpledali.util.optional_date(date_str)
simpledali.util.INFO_VERSION = 'Version'
simpledali.util.INFO_SERVERID = 'ServerID'
simpledali.util.INFO_CAPABILITIES = 'Capabilities'
simpledali.util.INFO_STATUS = 'Status'
simpledali.util.INFO_STREAMLIST = 'StreamList'
simpledali.util.INFO_STREAM = 'Stream'
simpledali.util.prettyPrintInfo(info)
simpledali.util.encodeAuthToken(user_id, expireDelta, writePattern, secretKey)

Note token auth is not part of ringserver proper, uses a fork I created.

Generates a ringserver Auth Token user_id: user name expireDelta: lifetime of token, ex timedelta(days=1, seconds=60) writePattern: streamid reg exp, ex ‘XX_.*/MTRIG’ secretKey: encryption pass phrase, should be > 32, longer is ok :return: string, base64 encoded signed jwt token

simpledali.util.decodeAuthToken(encodedToken, secretKey)

Note token auth is not part of ringserver proper, uses a fork I created.

simpledali.util.timeUntilExpireToken(token)

Note token auth is not part of ringserver proper, uses a fork I created.