subgrounds.utils module#
Utility module for Subgrounds
- subgrounds.utils.flatten(t)#
- subgrounds.utils.identity(x)#
- subgrounds.utils.fst(tup)#
- subgrounds.utils.snd(tup)#
- subgrounds.utils.intersection(l1, l2, key=<function identity>, combine=<function <lambda>>)#
- subgrounds.utils.rel_complement(l1, l2, key=<function identity>)#
- subgrounds.utils.sym_diff(l1, l2, key=<function identity>)#
- subgrounds.utils.union(l1, l2, key=<function identity>, combine=<function <lambda>>)#
- subgrounds.utils.filter_none(items)#
- subgrounds.utils.loop_generator(items)#
- subgrounds.utils.repeat(value, n)#
- subgrounds.utils.extract_data(keys, data)#
- subgrounds.utils.flatten_dict(data, keys=[])#
Takes a dictionary containing key-value pairs where all values are of type other than list and flattens it such that all key-value pairs in nested dictionaries are now at depth 1.
- subgrounds.utils.contains_list(data)#
Returns True if data contains a value of type list in its nested data and False otherwise
- subgrounds.utils.default_header(url)#
Contains the default header information for requests made by subgrounds
- Inserts the Playgrounds API Key iff:
a) targetting the Playgrounds API AND b) if the PLAYGROUNDS_API_KEY environment variable is set
- subgrounds.utils.user_agent()#
A basic user agent describing the following details:
"Subgrounds" (and version)
Platform/OS (and architecture)
Python Type (and version)
Examples: - Subgrounds/1.1.2 (Darwin; arm64) CPython/3.11.2 - Subgrounds/1.1.2 (Emscripten; wasm32) CPython/3.10.2
- ⚠️ To override this, construct your
Subgrounds
with a headers parameter with a dictionary containing an empty "User-Agent" key-value pairing.