Skip to content
Myr

added support for explicit filenames in `files` parameter.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

files = { "files[]": ("myfile", open("foo")), }

authored by Rolando Espinoza La fuente · committed by Rolando Espinoza La fuente · parent 6b129ec · Browse files · 1 file+7 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−1 removed

  • other:+7 added−1 removed

1 file+7 added−1 removed

modified:requests/models.py+7 added-1 removed
369 unmodified lines
370 except AttributeError:371 fields = dict(self.data)372373 for (k, v) in self.files.items():374 # support for explicit filename375 if isinstance(v, (tuple, list)):376 fn, fp = v377 else:378 fn = guess_filename(v) or k379 fp = v374 fields.update({k: (guess_filename(k) or k, v.read())})380 fields.update({k: (fn, fp.read())})381382 (body, content_type) = encode_multipart_formdata(fields)383 else:384 pass
240 unmodified lines