Skip to content
/ attd Public

Python dictionary with attribute access to keys

License

Notifications You must be signed in to change notification settings

otsaloma/attd

Repository files navigation

Attribute Dictionary

Test PyPI Downloads

attd is a Python package that provides a dictionary with attribute access to keys. It is especially convenient when working with deeply nested data from JSON APIs.

Installation

# Latest stable version
pip install -U attd

# Latest development version
pip install -U git+https://github.com/otsaloma/attd

Documentation

>>> from attd import AttributeDict
>>> data = AttributeDict({"a": {"b": {"c": 1}}})
>>> data["a"]["b"]["c"]
1
>>> data.a.b.c
1
>>> from attd import FallbackAttributeDict
>>> data = FallbackAttributeDict()
>>> data["a"]["b"]["c"]
{}
>>> data.a.b.c
{}