Skip to content

Commit 7afd331

Browse files
committed
Added atrritube test for readable Objects
1 parent 4807f21 commit 7afd331

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/lighthouseweb3/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ def uploadBlob(self, source: io.BufferedReader, filename: str) -> t.Upload:
3333
:param source: str, path to file or directory
3434
:return: t.Upload, the upload result
3535
"""
36+
if not (hasattr(source, 'read') and hasattr(source, 'close')):
37+
raise TypeError("source must have 'read' and 'close' methods")
3638
try:
3739
return d.uploadBlob(source, filename, self.token)
3840
except Exception as e:

0 commit comments

Comments
 (0)