Utils#

class frameioclient.Utils#
static calculate_hash(file_path, progress_callback=None)#

Calculate an xx64hash

Parameters:
  • file_path (str) – The path on your system to the file you’d like to checksum

  • progress_callback (Optional[Any]) – A progress callback to use when you want to callback w/ progress

static compare_items(dict1, dict2)#

Python 2 and 3 compatible way of comparing 2x dictionaries

Parameters:
  • dict1 (Dict) – Dictionary 1 for comparison

  • dict2 (Dict) – Dictionary 2 for comparison

Return type:

bool

static format_headers(token, version)#

[summary]

Parameters:
  • token (str) – Frame.io OAuth/Dev Token to use

  • version (str) – The version of the frameioclient sdk to add to our HTTP header

Return type:

Dict

static format_value(value, type=FormatTypes.SIZE)#

Convert bytes to KB/MB/GB/TB/s

Parameters:
  • value (int) – a numeric value

  • type (FormatTypes) – the FormatType specified

Return type:

str

static get_valid_filename(s)#

Strip out invalid characters from a filename using regex

Parameters:

s (str) – Filename to remove invalid characters from

Return type:

str

static normalize_filename(fn)#

Normalize filename using pure python

Parameters:

fn (str) – Filename to normalize using pure python

Return type:

str

static stream(func, page=1, page_size=20)#

Accepts a lambda of a call to a client list method, and streams the results until the list has been exhausted.

Parameters:

fun (function) – A 1-arity function to apply during the stream

Example:

stream(lambda pagination: client.get_collaborators(project_id, **pagination))