Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cosven/april
一个失败但是还算好玩的玩具
https://github.com/cosven/april
deserialization json model python
Last synced: 14 days ago
JSON representation
一个失败但是还算好玩的玩具
- Host: GitHub
- URL: https://github.com/cosven/april
- Owner: cosven
- License: mit
- Created: 2017-04-27T14:59:05.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-23T18:21:26.000Z (over 6 years ago)
- Last Synced: 2024-12-04T05:05:19.305Z (20 days ago)
- Topics: deserialization, json, model, python
- Language: Python
- Homepage:
- Size: 36.1 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# april
[![Build Status](https://travis-ci.org/cosven/april.svg?branch=master)](https://travis-ci.org/cosven/april)
[![Coverage Status](https://coveralls.io/repos/github/cosven/april/badge.svg?branch=master)](https://coveralls.io/github/cosven/april?branch=master)lightweight & declarative model/struct representation, work as you expected it to
## Usage
### simple usage
```python
from datetime import datetimefrom april import Struct
class User(Struct):
_fields = ['name', 'age', 'birthday']user = UserModel(name='lucy', age=20, birthday='2017-09-08')
user2 = UserModel(name='hey')class VIP(User):
_fields = ['level']vip = VIP(user, level=1)
vip.name == lucy
user2.age is None
```> tips: `april` usually works along with serialization library, such as [marshmallow](http://marshmallow.readthedocs.io/en/latest/quickstart.html#deserializing-to-objects)