bimmer_connected.utils

General utils and base classes used in the library.

class bimmer_connected.utils.MyBMWJSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]

JSON Encoder that handles data classes, properties and additional data types.

default(o) str | dict[source]

Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this:

def default(self, o):
    try:
        iterable = iter(o)
    except TypeError:
        pass
    else:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return JSONEncoder.default(self, o)
bimmer_connected.utils.get_class_property_names(obj: object)[source]

Return the names of all properties of a class.

bimmer_connected.utils.log_response_store_to_file(response_store: List[AnonymizedResponse], logfile_path: Path) None[source]

Log all responses to files.

bimmer_connected.utils.parse_datetime(date_str: str) datetime | None[source]

Convert a time string into datetime.

bimmer_connected.utils.to_camel_case(input_str: str) str[source]

Convert SNAKE_CASE or snake_case to camelCase.