Skip to main content

Abstracts HTTP request input handling, providing an easy interface for data hydration and validation

Project description

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:

$ pip install fractal_input

  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']

Project details


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-1.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

fractal_input-1.1.0-py2.py3-none-any.whl (5.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file fractal-input-1.1.0.tar.gz.

File metadata

  • Download URL: fractal-input-1.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for fractal-input-1.1.0.tar.gz
Algorithm Hash digest
SHA256 d2c81c373792a7a2c5baf9ab1a1fefc1b9570de7d2ea72990d9e874aa2d8d383
MD5 5c1899714490c34c6e545a464dae7bcb
BLAKE2b-256 c0347e18e9fda14ea3f3900e859f1c65c60ae27530d7304e8e6a663acffac7ff

See more details on using hashes here.

File details

Details for the file fractal_input-1.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for fractal_input-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9c6a29a729bca438433f682a0d774173bde2774beef09c03cebea589c7e41dfc
MD5 fb73da348177a826825116ff7ec28a92
BLAKE2b-256 45d49799e5b76d5e24154bd1ededd4771b09fdd676df3825bdf1b9a7abe7ee9c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page