boddle icon indicating copy to clipboard operation
boddle copied to clipboard

Incorrect check if body is a string

Open udalrich opened this issue 4 years ago • 1 comments

The code checks if body is a string by doing if body.lower:. That passes if it is a string, but throws an exception if body is a io.BufferedReader, such as what one gets from

with open('someFile.bin', 'rb') as f:
  with boddle(body=f):
     pass

It would also fail if the file-like object happens to have a lower method/attribute

udalrich avatar Jul 23 '20 18:07 udalrich

i think adding support for passing file-like objects in for body is a good idea. open to a PR. :)

keredson avatar Aug 11 '20 18:08 keredson