Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add support for pathlib.Path #90

Open
l-lumin opened this issue Dec 17, 2024 · 2 comments
Open

Feature request: Add support for pathlib.Path #90

l-lumin opened this issue Dec 17, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@l-lumin
Copy link
Contributor

l-lumin commented Dec 17, 2024

Description

pathlib.Path is widely used and preferred over os for file system operations in modern Python. It would be beneficial to support pathlib.Path

Related code

def convert(
self, source: Union[str, requests.Response], **kwargs: Any
) -> DocumentConverterResult: # TODO: deal with kwargs
"""
Args:
- source: can be a string representing a path or url, or a requests.response object
- extension: specifies the file extension to use when interpreting the file. If None, infer from source (path, uri, content-type, etc.)
"""
# Local path or url
if isinstance(source, str):
if (
source.startswith("http://")
or source.startswith("https://")
or source.startswith("file://")
):
return self.convert_url(source, **kwargs)
else:
return self.convert_local(source, **kwargs)
# Request response
elif isinstance(source, requests.Response):
return self.convert_response(source, **kwargs)

@ameyakhot
Copy link

solving.

@SigireddyBalasai
Copy link

@ameyakhot i already did it

@gagb gagb added the enhancement New feature or request label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants