How to use the wsgidav.wsgidav_app.WsgiDAVApp function in WsgiDAV

To help you get started, we’ve selected a few WsgiDAV examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mar10 / wsgidav / tests / test_wsgidav_app.py View on Github external
"lock_manager": True,  # True: use lock_manager.LockManager
        }

        if withAuthentication:
            config["http_authenticator"].update(
                {
                    "accept_basic": True,
                    "accept_digest": False,
                    "default_to_digest": False,
                }
            )
            config["simple_dc"]["user_mapping"] = {
                "/": {"tester": {"password": "secret", "description": "", "roles": []}}
            }

        return WsgiDAVApp(config)
github mar10 / wsgidav / wsgidav / server / server_sample.py View on Github external
def main():
    root_path = gettempdir()
    provider = FilesystemProvider(root_path)

    config = {
        "provider_mapping": {"/": provider},
        "http_authenticator": {
            "domain_controller": None  # None: dc.simple_dc.SimpleDomainController(user_mapping)
        },
        "simple_dc": {"user_mapping": {"*": True}},  # anonymous access
        "verbose": 1,
        "enable_loggers": [],
        "property_manager": True,  # True: use property_manager.PropertyManager
        "lock_manager": True,  # True: use lock_manager.LockManager
    }
    app = WsgiDAVApp(config)

    # For an example, use CherryPy
    from cherrypy.wsgiserver import CherryPyWSGIServer

    server = CherryPyWSGIServer(
        bind_addr=(config["host"], config["port"]),
        wsgi_app=app,
        server_name="WsgiDAV/{} {}".format(__version__, CherryPyWSGIServer.version),
    )

    try:
        server.start()
    except KeyboardInterrupt:
        print("Caught Ctrl-C, shutting down...")
    finally:
        server.stop()
github pmp-p / fel-installer / fel-release / fileserve.py View on Github external
def davserver_run():
    global davserver
    SUPPORTED_SERVERS = { "cheroot": runCheroot, }
    config = _initConfig()

    app = WsgiDAVApp(config)
    server = config["server"]
    handler = SUPPORTED_SERVERS.get(server)
    if not handler:
        raise RuntimeError("Unsupported server type {!r} (expected {!r})"
                           .format(server, "', '".join(SUPPORTED_SERVERS.keys())))

    if not useLxml and config["verbose"] >= 1:
        print("WARNING: Could not import lxml: using xml instead (slower).")
        print("         Consider installing lxml https://pypi.python.org/pypi/lxml.")

    config["verbose"] = 0

    davserver = handler(app, config, server)
    try:
        davserver.start()
    except KeyboardInterrupt:
github thisismedium / message-db / mdb / webdav / dav.py View on Github external
def App(**settings):
    """A WSGI app that supports WebDAV."""

    config = dict(wsgidav_app.DEFAULT_CONFIG, **settings)
    return wsgidav_app.WsgiDAVApp(config)
github sevagas / macro_pack / src / modules / Wlisten_server.py View on Github external
'add_header_MS_Author_Via': True,
            'unquote_path_info': False,
            're_encode_path_info': None,
            'host': '0.0.0.0',
            'dir_browser': {'davmount': False,
                'enable': True, #Enabling directory browsing on dir_browser
                'ms_mount': False,
                'show_user': True,
                'ms_sharepoint_plugin': True,
                'ms_sharepoint_urls': False,
                'response_trailer': False},
            'port': self.listenPort,    # Specifying listening port
            'provider_mapping': {'/': self.WRoot}   #Specifying root folder
        }

        app = WsgiDAVApp(config)

        server_args = {
            "bind_addr": (config["host"], config["port"]),
        "wsgi_app": app,
        }
        server = wsgi.Server(**server_args)
        
        try:
            log = logging.getLogger('wsgidav')
            log.raiseExceptions = False # hack to avoid false exceptions
            log.propagate = True
            log.setLevel(logging.INFO)
            server.start()
        except KeyboardInterrupt:
            logging.info("  [!] Ctrl + C detected, closing WebDAV sever")
            server.stop()
github AdrianVollmer / PowerHub / powerhub / webdav.py View on Github external
},
        "/public": {
            "root": WEBDAV_PUBLIC,
        },
        "/blackhole": {
            "root": WEBDAV_BLACKHOLE,
        },
        "/": {
            "root": WEBDAV_DIR,
            "readonly": True,
        }
    },
    "verbose": 1,
    }

app = WsgiDAVApp(config)

server_args = {
    "bind_addr": (config["host"], config["port"]),
    "wsgi_app": app,
    }
server = wsgi.Server(**server_args)


class MyHandler(FileSystemEventHandler):
    def on_created(self, event):
        os.rename(
            os.path.join(event.src_path),
            os.path.join(BLACKHOLE_DIR, os.path.basename(event.src_path)),
        )
github pangyemeng / myjob / pyspider / pyspider_es / pyspider / webui / webdav.py View on Github external
config = DEFAULT_CONFIG.copy()
config.update({
    'mount_path': '/dav',
    'provider_mapping': {
        '/': ScriptProvider(app)
    },
    'domaincontroller': NeedAuthController(app),
    'verbose': 1 if app.debug else 0,
    'dir_browser': {'davmount': False,
                    'enable': True,
                    'msmount': False,
                    'response_trailer': ''},
})
dav_app = WsgiDAVApp(config)