Helpers for arguments

Bytes

lightmlrestapi.args.bytes2string (content)

Converts bytes to string.

lightmlrestapi.args.string2bytes (content)

Converts string to bytes.

Encryption

lightmlrestapi.args.encrypt_password (pwd, algo = ‘sha224’)

Encrypts one password.

lightmlrestapi.args.encrypt_passwords (users, algo = ‘sha224’)

Encrypts users passwords.

lightmlrestapi.args.load_passwords (source)

Loads the encrypted passwords from a filename, a dataframe, a list of tuple.

Images

lightmlrestapi.args.base642image (encoded)

Gets an encoded image and builds an PIL.Image.Image from it.

lightmlrestapi.args.image2array (img)

Converts a color imaged into an array.

lightmlrestapi.args.image2base64 (path, fmt = ‘png’)

Encodes an image into base64.

Zip in memory

lightmlrestapi.args.unzip_bytes (buffer)

Unzips everything from a buffer.

lightmlrestapi.args.zip_dict (data, kwargs)

Zips a dictionary { str: bytes }.