Python builtin dictionary extension that supports dot notation access. Trying to access a key that does not exist doesn't throw an exception
from dictextra import AttributeDict
mydict = {"country": "Nigeria", "coords": [{"lat": 33567.6, "long": 37363.7}]}
mydict = AttributeDict(mydict)
coords = mydict.coords // [{"lat": 33567.6, "long": 37363.7}]
latitude = coords[0].lat // 33567.6
longitude = coords[0]["long"] // can also access it the traditional way
Package can be installed from pypi using pip as below
pip install dictextra
Alternatively, clone the repo and install package from source as below:
git clone https://github.com/austitech/dictextra
cd dictextra
python3 setup.py sdist