Skip to main content

Multipart formdata decoder

Project description

Python package Upload Python Package

Birman

Multipart formdata decoder library.

Install

pip install birman

Get started

Decode multipart form data

from birman import Decoder
# multipart_data = b'---- ...etc'

decoder = Decoder(multipart_data)
result = decoder.decode()

This would return a normalized dict

# example from params - ?email=test@test.com&password=wizard
# result -
{
    "email": {
        "name": "email",
        "value": "test@test.com",
    },
    "password": {
        "name": "password",
        "value": "wizard",
    },
}

Parse URI form params

from birman import Encoder

arg = "?email=test@test.com&password=wizard"
result = Encoder.parse_params(arg)

This would return a normalized dict

# result -
{
    "email": {
        "name": "email",
        "value": "test@test.com",
    },
    "password": {
        "name": "password",
        "value": "wizard",
    },
}

Multipart Formdata

The decoder method will return file data extracted from the multipart formdata as a dict.

{
    'name': 'logo',
    'type': 'file',
    'value': {
        'filename': 'bobtail.png',
        'mimetype': 'image/png', 
        'file_data': b'...',
        'type': 'file',
}

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

birman-0.0.2.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

birman-0.0.2-py3-none-any.whl (4.3 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