Skip to content

Instantly share code, notes, and snippets.

View kazqvaizer's full-sized avatar
😎
Wow!

Alexey Chudin kazqvaizer

😎
Wow!
  • Netherlands
View GitHub Profile
@kazqvaizer
kazqvaizer / multipartify.py
Last active September 18, 2023 14:16
Python dict to multipart/form-data converter to use it requests
"""
Here is a way to flatten python dictionaries for making multipart/form-data POST requests.
{"some": ["balls", "toys"], "field": "value", "nested": {"objects": "here"}}
->
{"some[0]": "balls", "some[1]": "toys", "field": "value", "nested[objects]": "here"}