Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/otsaloma/attd
Python dictionary with attribute access to keys
https://github.com/otsaloma/attd
dictionary python
Last synced: 3 months ago
JSON representation
Python dictionary with attribute access to keys
- Host: GitHub
- URL: https://github.com/otsaloma/attd
- Owner: otsaloma
- License: mit
- Created: 2018-10-13T23:16:50.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-11-07T21:47:27.000Z (about 1 year ago)
- Last Synced: 2024-09-13T12:25:06.393Z (4 months ago)
- Topics: dictionary, python
- Language: Python
- Size: 36.1 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
Attribute Dictionary
====================[![Test](https://github.com/otsaloma/attd/workflows/Test/badge.svg)](https://github.com/otsaloma/attd/actions)
[![PyPI](https://img.shields.io/pypi/v/attd.svg)](https://pypi.org/project/attd/)
[![Downloads](https://pepy.tech/badge/attd/month)](https://pepy.tech/project/attd)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
```bash
# Latest stable version
pip install -U attd# Latest development version
pip install -U git+https://github.com/otsaloma/attd
```## Documentation
```python
>>> 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
{}
```