Better solution would be, if instead of a file object the file path could be assigned and the api itselfs creates the required file object (and could decide, if it needs a 'r' or 'rb' mode , what differs between py2 and py3)
Cause of backward compatibility, the file object must still be supported as argument, too.
As error handling for #34 and #39, it should be tried to close the file object and reopen it again with a different read mode.
Issues #34 and #39 shows, that the current workflow for uploading attachments is not user friendly and prone to errors.
Better solution would be, if instead of a file object the file path could be assigned and the api itselfs creates the required file object (and could decide, if it needs a 'r' or 'rb' mode , what differs between py2 and py3)
Cause of backward compatibility, the file object must still be supported as argument, too. As error handling for #34 and #39, it should be tried to close the file object and reopen it again with a different read mode.