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

How to assemble urlpath from given fs or protocol? #898

Open
CyberCoder-X opened this issue Jan 29, 2022 · 2 comments
Open

How to assemble urlpath from given fs or protocol? #898

CyberCoder-X opened this issue Jan 29, 2022 · 2 comments

Comments

@CyberCoder-X
Copy link

Does fsspec provide any API to assemble urlpath or local path from given fs or protocol?
e.g

def get_path(protocol, file_path):
    # decide which pattern to use
    # return "/xxx/xxx" or "protocol://xxx/xxx"

path1 = get_path('file', "xxx/xxx")
# path1:    /xxx/xxx
path2 = get_path('s3', "xxx/xxx")
# path2:    s3://xxx/xxx
@e-roux
Copy link
Contributor

e-roux commented Feb 4, 2022

I think this is still an open point, see #114 and drivendataorg/cloudpathlib#96

@martindurant
Copy link
Member

The function you want is fsspec.utils._unsrip_protocol, which is used internally but not documented. In #828 (which has stalled), this will be made a method on a filesystem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants