Extra fields for Marshmallow (bugfix)
Project description
marshmallow-extras
Extras for marshmallow.
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
- 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)))
- Install the package (this should install all the required child packages.
- Run the file.
Package Details
This package has the following classes
FurlField - Field for Furl Objects (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
File details
Details for the file mshextras-0.5.tar.gz.
File metadata
- Download URL: mshextras-0.5.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.6.0 requests-toolbelt/0.8.0 tqdm/4.46.1 CPython/3.9.0a1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d5ecc6159192a80614f10ed4001a7d581f31d52bba1c751e72d5c133d3d83b0
|
|
| MD5 |
070de1544eab574f616cbed1160f0e98
|
|
| BLAKE2b-256 |
d6bcb48ce68e92b6f0912c6502f52196374ac45c8710841cb75cc48f8a66a249
|