Add basic UI with bootstrap and allauth profile handling

This commit is contained in:
Shaun Kruger
2026-12-01 16:46:55 -07:00
parent b3b51f6cc5
commit af18031a14
26 changed files with 3283 additions and 10 deletions
+12 -6
View File
@@ -32,6 +32,7 @@ def upload_asset(
base_url: str,
api_key: str,
file_path: str,
bucket: str,
key: str,
user_name: int = 1,
) -> dict:
@@ -58,9 +59,9 @@ def upload_asset(
# boto3.set_stream_logger('botocore', logging.DEBUG)
# logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
userinfo = requests.get(f"{base_url}/api/userinfo", headers={"Authorization": f"Bearer {api_key}"})
userinfo.raise_for_status()
user_data = userinfo.json()
# userinfo = requests.get(f"{base_url}/api/userinfo", headers={"Authorization": f"Bearer {api_key}"})
# userinfo.raise_for_status()
# user_data = userinfo.json()
s3creds = requests.post(f"{base_url}/api/s3keys", headers={"Authorization": f"Bearer {api_key}"})
s3creds.raise_for_status()
@@ -72,7 +73,7 @@ def upload_asset(
print(f"\nS3 Credentials obtained:")
print(f" Access Key: {access_key}")
print(f" Secret Key: {secret_key[:10]}...{secret_key[-10:]}") # Masked for security
print(f" Bucket: {user_data.get('bucket')}")
print(f" Bucket: {bucket}")
file_path_obj = Path(file_path)
if not file_path_obj.exists():
@@ -100,8 +101,7 @@ def upload_asset(
try:
# Upload the file
file_size = file_path_obj.stat().st_size
bucket = user_data['bucket']
# print(f"\n{'='*60}")
# print(f"Starting upload:")
# print(f" File: {file_path}")
@@ -190,6 +190,11 @@ Examples:
default=1,
help="User ID (defaults to 1)",
)
parser.add_argument(
"--bucket",
required=True,
help="S3 bucket name (e.g., demo)",
)
args = parser.parse_args()
@@ -200,6 +205,7 @@ Examples:
file_path=args.file,
key=args.key,
user_name=args.user_id,
bucket=args.bucket,
)
print(f"\nUpload completed: {result}")
return 0