0

I'm using Python poster module 0.8.1 and I was wondering if it possible to increase default upload buffer size or 'blocksize' ? I found that default buffer size is 4096 bytes ( http://atlee.ca/software/poster/poster.encode.html#poster.encode.MultipartParam.iter_encode ) I tried to search some hints in documentation but no luck.

dovydas juraska
  • 277
  • 2
  • 5
  • 12

1 Answers1

1

The API does not give you the opportunity to set the blocksize, no.

You can increase the buffer by patching the constant on the function:

from poster.encode import MultipartParam

iter_encode = MultipartParam.iter_encode.im_func  # function object
iter_encode.func_defaults = (8192,)  # set new defaults, a 1-element tuple

The .func_defaults parameter of functions can be replaced at will, just make sure you replace it with a tuple of equal length.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343