Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.
The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!
Nice answer on stackoverflow to the question of when to use one or the other content-types for POSTing data, viz. application/x-www-form-urlencoded
and multipart/form-data
.
“The moral of the story is, if you have binary (non-alphanumeric) data (or a significantly sized payload) to transmit, use multipart/form-data
. Otherwise, use application/x-www-form-urlencoded
.”
Matt Bridges' answer in full:
The MIME types you mention are the two Content-Type
headers for HTTP POST requests that user-agents (browsers) must support. The purpose of both of those types of requests is to send a list of name/value pairs to the server. Depending on the type and amount of data being transmitted, one of the methods will be more efficient than the other. To understand why, you have to look at what each is doing
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# create multiple machines in a single Vagrantfile and ensure that we can ssh into them without using vagrant. | |
Vagrant.configure("2") do |config| | |
config.vm.box = "centos/7" | |
config.ssh.insert_key = false | |
config.ssh.private_key_path = ["~/.vagrant.d/insecure_private_key", "~/.ssh/terraform"] |
public class GeneratePermutations { | |
static <E> List<E> addToCopy(List<E> original, int pos, E e) { | |
final var r = new ArrayList<>(original); | |
r.add(pos, e); | |
return r; | |
} | |
public static <E> List<List<E>> generatePermutations(List<E> original) { | |
if (original.isEmpty()) { | |
return List.of(new ArrayList<>()); |
# Get basic summary of versions in Confluent Cloud schema registry. | |
# You need to provide the SR url as well as SR apikey and api secret (lines 6 - 8 below). | |
import requests | |
from requests.auth import HTTPBasicAuth | |
sr_apikey = '' | |
sr_apisecret = '' | |
sr_url = '' | |
auth = HTTPBasicAuth(sr_apikey, sr_apisecret) |
appenders=console | |
appender.console.type=Console | |
appender.console.name=Console | |
appender.console.layout.type=PatternLayout | |
appender.console.layout.pattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%c] - %msg%n | |
# root logger | |
rootLogger.level=info | |
rootLogger.appenderRefs=stdout | |
rootLogger.appenderRef.stdout.ref=Console |
localhost:8082
docker compose up -d
# please be patient...