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 details)

Uploaded Source

Built Distribution

birman-0.0.2-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file birman-0.0.2.tar.gz.

File metadata

  • Download URL: birman-0.0.2.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for birman-0.0.2.tar.gz
Algorithm Hash digest
SHA256 a9b61576a4d8adde0eab5784b1c7f73de75d4dfef04b36f0913d82cca0d1e7d0
MD5 59aa94511291a5ad3bc0666187eb68c7
BLAKE2b-256 6c0bbd4973a925a2b948cebd4776ef1b6ca58ddfb2dc18422e6b9276c219f5f4

See more details on using hashes here.

File details

Details for the file birman-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: birman-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for birman-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 277d94226f210c71ae02e0c97ab168ceff2b58fd41a49ae1437dab5f074545b6
MD5 13ade7b951746e80dc17c0555e719ec0
BLAKE2b-256 406342649fe1f0f40c695267366ffd41514e8798ab70e8e412fd7af1bb13dad6

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