Skip to main content

Extra fields for Marshmallow

Project description

marshmallow-extras

Extras for marshmallow.

forthebadge forthebadge

codecov Build Status

marshmallow-extras is a python package which helps in serialization of heavy and hardcore objects easily using marshmallow (cause this is a plugin for marshmallow)

Installing

Using Github

git clone https://github.com/bnnk/marshmallow-extras
cd marshmallow-extras
pip install -e .

or use the install/linux.sh.sh (on linux) or install/windows.bat (on windows)

Using PyPI

pip install marshmallow-extras

Testing the installation

  1. Copy the code from here and paste it into a file.
from mshextras import *
import pyotp
import pandas as pd
import numpy as np
from requests import get
from xml.etree import ElementTree as ET
from furl import furl
from marshmallow import Schema
class TestingSchema(Schema):
    furl = FurlField()
    df = PandasDataFrameField()
    arr = NumPyArrayField()
    req = HTTPRequestField()
    et = ElementTreeField()
    ho = HOTPField()
    to = TOTPField()
ent = dict(
    furl = furl("bz2://"),
    df = pd.DataFrame({"a" : ["12"], "B" : ["13"]}),
    arr = np.array([1,2,3,4,5]),
    req = get("http://google.com"),
    ho = pyotp.hotp.HOTP(pyotp.random_base32()),
    to = pyotp.totp.TOTP(pyotp.random_base32())
)
print(TestingSchema().dump(ent))
print(TestingSchema().load(TestingSchema().dump(ent)))
  1. Install the package (this should install all the required child packages.
  2. Run the file.

Package Details

This package has the following classes

FurlField - Field for Furl Objects ![https://github.com/gruns/furl/blob/master/README.md]((read more about this package here)) PandasDataFrameField - Field for pandas Dataframe NumPyArrayField - Field for numpy arrays HTTPRequestField - Field for Requests's get(),post(),put() or request() method's Response class ElementTreeField - Field for xml.etree.ElementTree objects HOTPField - Field for PyOTP's HOTP objects TOTPField - Field for PyOTP's TOTP objects

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

mshextras-0.2.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

mshextras-0.2-py3-none-any.whl (15.5 kB view hashes)

Uploaded Python 3

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