Fractal Input
======================================
|Build Status| |Version| |Pyversions|
Abstracts HTTP request input handling, providing an easy interface for data hydration and validation Based on https://github.com/LinioIT/input
Documentation
~~~~~~~~~~~~~
Usage
^^^^^
Install:
''''''''
.. code:: bash
$ pip install fractal_input
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
.. code:: python
from fractal_input import InputHandler, DatetimeNode, ListNode
class UserHandler(InputHandler):
def define(self):
user = self.add('user', User)
user.add('name', 'string')
user.add('email', 'string')
user.add('age', 'integer', {'required': False})
user.add('createdAt', DatetimeNode('%m/%d/%y %H:%M:%S'))
address = user.add('address', Address)
address.add('street', 'string')
telephone = user.add('telephones', ListNode(Telephone))
telephone.add('number', 'string')
dict_data = {
'user': {
'name': 'James',
'email': 'james@email.com',
'age': 20
}
}
input = UserHandler()
input.bind(dict_data)
if not input.is_valid():
print(input.get_error_as_string())
user = input.get_data()['user']
''''
.. |Build Status| image:: https://travis-ci.org/jefersondaniel/fractal-input.svg
:target: https://travis-ci.org/jefersondaniel/fractal-input
.. |Version| image:: https://badge.fury.io/py/fractal_input.svg
:target: https://pypi.python.org/pypi/fractal_input
.. |Pyversions| image:: https://img.shields.io/pypi/pyversions/fractal_input.svg
:target: https://pypi.python.org/pypi/fractal_input
======================================
|Build Status| |Version| |Pyversions|
Abstracts HTTP request input handling, providing an easy interface for data hydration and validation Based on https://github.com/LinioIT/input
Documentation
~~~~~~~~~~~~~
Usage
^^^^^
Install:
''''''''
.. code:: bash
$ pip install fractal_input
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
.. code:: python
from fractal_input import InputHandler, DatetimeNode, ListNode
class UserHandler(InputHandler):
def define(self):
user = self.add('user', User)
user.add('name', 'string')
user.add('email', 'string')
user.add('age', 'integer', {'required': False})
user.add('createdAt', DatetimeNode('%m/%d/%y %H:%M:%S'))
address = user.add('address', Address)
address.add('street', 'string')
telephone = user.add('telephones', ListNode(Telephone))
telephone.add('number', 'string')
dict_data = {
'user': {
'name': 'James',
'email': 'james@email.com',
'age': 20
}
}
input = UserHandler()
input.bind(dict_data)
if not input.is_valid():
print(input.get_error_as_string())
user = input.get_data()['user']
''''
.. |Build Status| image:: https://travis-ci.org/jefersondaniel/fractal-input.svg
:target: https://travis-ci.org/jefersondaniel/fractal-input
.. |Version| image:: https://badge.fury.io/py/fractal_input.svg
:target: https://pypi.python.org/pypi/fractal_input
.. |Pyversions| image:: https://img.shields.io/pypi/pyversions/fractal_input.svg
:target: https://pypi.python.org/pypi/fractal_input
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fractal_input-2.1.0.tar.gz
(5.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fractal_input-2.1.0.tar.gz.
File metadata
- Download URL: fractal_input-2.1.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b2721cdaaf38a79c7d0dcdb77e0cca49f2ec45620c56790dec8fa594649408b
|
|
| MD5 |
32b3f3680b5666264f703fd21d308b51
|
|
| BLAKE2b-256 |
73728330b722b6745da80fe65483aec2170708354bb6d26fa950a63772544245
|
File details
Details for the file fractal_input-2.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: fractal_input-2.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7774e15a1ec31b1e7df57021476f7d29ae395b70e58f00ccb05b8067ee6efbce
|
|
| MD5 |
80bf647ca75756b7a4795ddadcf8d228
|
|
| BLAKE2b-256 |
9993bf08a2ebb05d581c684c301be44eb88989931ddb3d964ba5e47c319baffe
|