sigmavirus24 / requests-data-schemes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

requests_data_schemes

Author: Ian Cordasco
Version: 0.1
license:Apache

This is a small module meant to offer a simpler way for requests users to encode their data in a slightly more sensible way. So far this package only contains multipart_formdata which will not encode anything as a file for multipart/form-data. It comes with a test for the one function which will pass.

Examples

from requests_data_schemes import multipart_formdata
import requests


url = 'https://api.example.com/endpoint'
r1 = requests.post(url, data=multipart_formdata(
    [('key1', 'value1'), ('key2', 'value2')]), headers={
    'Content-Type': 'multipart/form-data'})
r2 = requests.post(url, data=multipart_formdata(
    {'key1': 'value1', 'key2': 'value2'}), headers={
    'Content-Type': 'multipart/form-data'})

About

License:Other


Languages

Language:Python 100.0%