Skip to main content

Extra fields for Marshmallow (bugfix)

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

Uploaded Source

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

Hashes for mshextras-0.5.tar.gz
Algorithm Hash digest
SHA256 8d5ecc6159192a80614f10ed4001a7d581f31d52bba1c751e72d5c133d3d83b0
MD5 070de1544eab574f616cbed1160f0e98
BLAKE2b-256 d6bcb48ce68e92b6f0912c6502f52196374ac45c8710841cb75cc48f8a66a249

See more details on using hashes here.

Supported by

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