From f5bbee12e6c3f2b11f3d3ef318af4218ab5d1ee3 Mon Sep 17 00:00:00 2001 From: Lynnesbian Date: Thu, 9 Apr 2020 22:12:30 +1000 Subject: [PATCH] initial framework and such --- .gitignore | 3 +++ .vscode/settings.json | 3 +++ bcmh.py | 18 ++++++++++++++++++ requirements.txt | 1 + 4 files changed, 25 insertions(+) create mode 100644 .vscode/settings.json create mode 100755 bcmh.py create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index 13d1490..c097bdc 100644 --- a/.gitignore +++ b/.gitignore @@ -129,3 +129,6 @@ dmypy.json # Pyre type checker .pyre/ + +# custom shit +config.json \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..db3fbff --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "/mnt/code/python/bcmh/venv/bin/python3.8" +} \ No newline at end of file diff --git a/bcmh.py b/bcmh.py new file mode 100755 index 0000000..75595ad --- /dev/null +++ b/bcmh.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +import boto3 +import json, argparse + +parser = argparse.ArgumentParser() +parser.add_argument("files", help = "File(s) to upload", nargs = '+') +parser.parse_args() + +cfg = json.load(open("config.json")) # TODO: support for ~/.aws/credentials, command line options + +s3 = boto3.resource( + 's3', + endpoint_url = "https://s3.wasabisys.com", #us-east-1 + aws_access_key_id = cfg['access_key_id'], + aws_secret_access_key = cfg['secret_access_key'] +) + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..dc54b66 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +boto3 ~= 1.12 \ No newline at end of file