Package: aliyunoss2-autoupload
Source:https://github.com/tanbro/aliyunoss2-autouploadPackage:https://pypi.org/project/aliyunoss2-autoupload/aliyunoss2-autouploadMonitor files by wildcard patterns, upload them to ALIYUN OSS, then move to backup directory.UsageCommand LineAfter the package installed, run the command in a terminator, show help messages$aliyunoss2-autoupload--helpusage: aliyunoss2-autoupload [-h] [--version] {run,echo_config_sample} ...

Watch files in a directory and upload them to Aliyun OSS on file writing
completed

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit

subcommands:

  {run,echo_config_sample}
                        <sub_command --help> Print the help of sub_commands
    run                 Start to run then program. It will monitor and upload
                        files continuously.
    echo_config_sample  Echo configure file sample$aliyunoss2-autouploadrun--helpusage: aliyunoss2-autoupload run [-h] [--only-once]
                                 [--config-file CONFIG_FILE]
                                 [--logging-config-file LOGGING_CONFIG_FILE]

optional arguments:
  -h, --help            show this help message and exit
  --only-once, -o       Upload only once, then exit. Will NOT monitor files.
                        (default=False)
  --config-file CONFIG_FILE, -c CONFIG_FILE
                        The program configuration file. The program will first
                        try to load configuration file by environment variable${ALIYUNOSS2_AUTOUPLOAD_CONF}.Iftheenvironmentvariable not assigned, then try to load configuration
                        file "conf/aliyunoss2-autoupload.yml"
  --logging-config-file LOGGING_CONFIG_FILE, -l LOGGING_CONFIG_FILE
                        The logging configuration file. The program will first
                        try to load logging configuration file by environment
                        variable ${ALIYUNOSS2_AUTOUPLOAD_LOG_CONF}. If the
                        environment variable not assigned, then try to load
                        configuration file
                        "conf/aliyunoss2-autoupload.log.yml"$aliyunoss2-autouploadecho_config_sample--helpusage: aliyunoss2-autoupload echo_config_sample [-h] {prog,log}

positional arguments:
{prog,log}  Configure file to echo

optional arguments:
-h, --help  show this help message and exitConfiguration FileThe program will first try to load configuration file from environment variableALIYUNOSS2_AUTOUPLOAD_CONF.
If the environment variable not assigned, then try to load configuration file“conf/aliyunoss2-autoupload.yml”.TheYAMLfile is like blow:---## Aliyun OSS configsoss:## Name of your Aliyun OSS bucketname:"your_bucket_name"## Endpoint URL of Aliyun OSS bucketendpoint:"oss-xx-xxxxxx.aliyuncs.com"## cname of the domain of Aliyun OSS bucket. Empty if no cname.cname:""## Access Key ID of Aliyun OSS bucketaccess_key_id:"your_access_key_id"## Access Key Secret of Aliyun OSS bucketaccess_key_secret:"your_access_key_secret"## Directory name configsdir:## Calculate uploading file relative name by this local directoryrel_dir:""## Upload files to OSS in this diross_dir:""## Move uploaded file the the directory. It MUST be a different dir from where the files are. If not, the file will be uploaded again and again.bak_dir:""## watcher configswatcher:## The time interval(seconds) this program scan the directoryinterval:30## If the interval between the current time and the file\'s modification time is greater than this value, the write is considered complete.write_complete_time:30## Pattern of the files to watch and uploadpatterns:"files/*.*"## If find patterns recursivelyrecursive:false## pool of at most max_workers threads to execute upload/backup tasks. If max_workers is None or not given, it will default to the number of processors on the machine, multiplied by 5.max_workers:~Also, the program will first try to load logging configuration file by environment variableALIYUNOSS2_AUTOUPLOAD_LOG_CONF.
If the environment variable not assigned, then try to load configuration file“conf/aliyunoss2-autoupload.log.yml”.Logging config file is alsoYAML.
Go tohttps://docs.python.org/3/library/logging.config.htmlfor more information about Python logging config.InstallInstall by pippip install aliyunoss2-autouploadInstall from codegit clone https://github.com/tanbro/aliyunoss2-autoupload.git
cd aliyunoss2-autoupload
path/of/your/python setup.py installChangelog0.1AddedReload configuration every time before scanning files.–only-oncecommand line option.Optimizedtest case formain()function0.1b2Date:2018-06-20AddsMore detailed documents.Bug Fixes:Remove files in.gitignore, but tracked.0.1b1Date:2018-06-19ChangesSupport oldPython 2.7,Python 3.4Config file name extension changed from".yaml"to".yml"Default config file environment variable nameDefault config file path if no environment variableAddsSome simple test casesCircleCICodacy0.1a3The first ever-usable version.Date:2018-04-18ChangesNow Python 3.5+ ONLY, becauseglob.iglobhas norecursiveargument and"**"wildcard in lower Python versionBug FixesBackup directory errorsOSS exceptionCONTRIBUTINGContributions are welcome!It’s advised to develop invenv/path/of/your/python -m venv .venv
source .venv/bin/activate
git clone git@github.com:tanbro/aliyunoss2-autoupload.git
cd aliyunoss2-autoupload
python setup.py developAuthorsliu xue yan <liu_xue_yan@foxmail.com>