v0tools
GitHub Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

v0upload.py

HTTP server that accepts PUT requests from remotes.

usage: v0upload.py [-h] [--interface INTERFACE] [--ipv {4,6}] [-p PORT] path

HTTP server that accepts PUT requests from remotes.

positional arguments:
  path                  Directory or file path.

optional arguments:
  -h, --help            show this help message and exit
  --interface INTERFACE, -i INTERFACE
                        network interface: i.e. tun0, eth0, if undefined, an fzf prompt will appear
  --ipv {4,6}           IP Version
  -p PORT, --port PORT  port number, or default random port in range:1025-65535.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""HTTP server that accepts PUT requests from remotes."""
from v0tools import cli
from v0tools.servers import httpserv

cli = cli.Cli()
cli.add_path()
cli.add_ipv_interface()
cli.add_port()

parser = cli.parser


def main(args):
    """Run main function."""
    httpserv.uploader(
        args.address,
        str(args.port),
        args.path,
    )


cli.set_entrypoint(main)

if __name__ == "__main__":
    args = cli.get_parse()
    main(args)