diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2015-02-20 18:35:30 +0100 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2015-02-21 18:22:33 +0100 |
commit | 083899d6088492b1bc7e01f74be015070224f2c2 (patch) | |
tree | 4fef8a619e5f345f556c177643098f6a506d5969 /fuse-httpfs | |
parent | 1ee6c90a3de10149b04f419ec9ff4b139efa0962 (diff) | |
download | fuse-httpfs-083899d6088492b1bc7e01f74be015070224f2c2.tar.gz fuse-httpfs-083899d6088492b1bc7e01f74be015070224f2c2.zip |
Some tests and using python netrc module
Diffstat (limited to 'fuse-httpfs')
-rwxr-xr-x | fuse-httpfs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/fuse-httpfs b/fuse-httpfs new file mode 100755 index 0000000..d955ec3 --- /dev/null +++ b/fuse-httpfs @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 +from httpfs import * + +if __name__ == '__main__': + import logging + FORMAT = "%(threadName)s %(asctime)-15s %(levelname)s:%(name)s %(message)s" + logging.basicConfig(level=logging.INFO, format=FORMAT) + + import argparse + p = argparse.ArgumentParser( + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + p.add_argument("mountpoint", nargs=1, help="Target directory") + p.add_argument("--max_background", type=int, default=15, + help="Maximum number of background threads") + p.add_argument("--no_foreground", action="store_true", default=False, + help="Fork into background as a daemon") + p.add_argument("--debug", action="store_true", help="Enable fuse debug") + p.add_argument("--nothreads", action="store_true", + help="Disable fuse threads") + p.add_argument("--connect_timeout", type=int, + default=Config.timeout[0], help="HTTP connect timeout") + p.add_argument("--read_timeout", type=int, + default=Config.timeout[1], help="HTTP read timeout") + p.add_argument("--no-verify", action="store_true", help="Disable ssl verify") + + args = vars(p.parse_args(sys.argv[1:])) + + Config.timeout = (args.pop("connect_timeout"), args.pop("read_timeout")) + Config.mountpoint = args.pop("mountpoint")[0] + Config.verify = not args.pop("no_verify") + kwargs = {} + if not args.pop("no_foreground"): + kwargs["foreground"] = True + if args.pop("debug"): + kwargs["debug"] = True + kwargs.update(args) + + fuse = fuse.FUSE(Httpfs(), Config.mountpoint, **kwargs) |