-
-
Notifications
You must be signed in to change notification settings - Fork 182
Open
Description
Have you looked into adding fsspec as a dependency? It would allow opening files from any location, including remote files.
my use case:
I want to open msg files from an s3 bucket and extract the content from there. Right now I have to use workarounds to get it working.
def handle_msg(filename: Path | str) -> str:
import extract_msg
if isinstance(filename, str) and filename.startswith("s3:"):
import s3fs
s3 = s3fs.S3FileSystem()
with s3.open(filename, 'rb') as f:
content = f.read()
msg = extract_msg.Message(io.BytesIO(content))
else:
msg = extract_msg.Message(filename)Using fsspec would mean you can just use any URI to load a file (not just a local path)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels