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.


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):
        iterable = iter(o)
    except TypeError:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return JSONEncoder.default(self, o)
bimmer_connected.utils.deprecated(replacement: Optional[str] = None) → Callable[[Callable[_P, _R]], Callable[_P, _R | None]][source]

Mark a function or property as deprecated.

bimmer_connected.utils.get_class_property_names(obj: object)[source]

Returns the names of all properties of a class.

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

Log all responses to files.

bimmer_connected.utils.parse_datetime(date_str: str) → Optional[datetime.datetime][source]

Convert a time string into datetime.

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

Converts SNAKE_CASE or snake_case to camelCase.