akashcli 4.8.4__tar.gz → 4.8.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {akashcli-4.8.4 → akashcli-4.8.5}/PKG-INFO +1 -1
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/__init__.py +1 -1
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/cli.py +62 -7
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/client.py +1 -1
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/storage.py +4 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/uploader.py +5 -1
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli.egg-info/PKG-INFO +1 -1
- {akashcli-4.8.4 → akashcli-4.8.5}/pyproject.toml +1 -1
- {akashcli-4.8.4 → akashcli-4.8.5}/README.md +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/_net.py +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/auth.py +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/config.py +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/crypto.py +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/env_manager.py +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/exceptions.py +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/exec.py +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/integrity.py +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/logger.py +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/models.py +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/p2p.py +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/packages.py +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/relay.py +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/restore.py +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/snapshot_crypto.py +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/terminal.py +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/updater.py +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli/utils.py +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli.egg-info/SOURCES.txt +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli.egg-info/dependency_links.txt +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli.egg-info/entry_points.txt +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli.egg-info/requires.txt +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/akashcli.egg-info/top_level.txt +0 -0
- {akashcli-4.8.4 → akashcli-4.8.5}/setup.cfg +0 -0
|
@@ -471,8 +471,14 @@ def cloud_upload(
|
|
|
471
471
|
password: Optional[str] = typer.Option(None, "--pass", "-p", help="Password-protect"),
|
|
472
472
|
):
|
|
473
473
|
"""Upload a file or text snippet."""
|
|
474
|
+
api_key, base = _resolve_client(require_key=False, silent=True)
|
|
475
|
+
if not api_key:
|
|
476
|
+
_err("Not logged in. You must be logged in to upload files.")
|
|
477
|
+
print(f" {_DM}Run {_C}akash login{_RS}{_DM} to log in, or set {_C}AKASH_API_KEY{_RS}{_DM}.{_RS}")
|
|
478
|
+
raise typer.Exit(1)
|
|
479
|
+
|
|
474
480
|
try:
|
|
475
|
-
client = AkashClient()
|
|
481
|
+
client = AkashClient(api_key=api_key, api_url=base)
|
|
476
482
|
|
|
477
483
|
def _cb(done, total):
|
|
478
484
|
bar = _progress_bar(done, total)
|
|
@@ -500,6 +506,19 @@ def cloud_upload(
|
|
|
500
506
|
raise typer.Exit(1)
|
|
501
507
|
|
|
502
508
|
|
|
509
|
+
@app.command("upload")
|
|
510
|
+
def app_upload(
|
|
511
|
+
path: Optional[Path] = typer.Argument(None, help="File to upload"),
|
|
512
|
+
text: Optional[str] = typer.Option(None, "--text", "-t", help="Upload raw text"),
|
|
513
|
+
name: Optional[str] = typer.Option(None, "--name", "-n", help="Custom filename"),
|
|
514
|
+
burn: bool = typer.Option(False, "--burn", help="Delete after first download"),
|
|
515
|
+
expiry: int = typer.Option(0, "--expiry","-e",help="Expire in N days (0 = never)"),
|
|
516
|
+
password: Optional[str] = typer.Option(None, "--pass", "-p", help="Password-protect"),
|
|
517
|
+
):
|
|
518
|
+
"""Upload a file or text snippet (requires login)."""
|
|
519
|
+
return cloud_upload(path=path, text=text, name=name, burn=burn, expiry=expiry, password=password)
|
|
520
|
+
|
|
521
|
+
|
|
503
522
|
# ── akash cloud files ─────────────────────────────────────────────────────────
|
|
504
523
|
|
|
505
524
|
@cloud_app.command("files")
|
|
@@ -604,8 +623,14 @@ def cloud_manage(
|
|
|
604
623
|
@cloud_app.command("bulk")
|
|
605
624
|
def cloud_bulk(path: Path):
|
|
606
625
|
"""Recursively upload every file in a folder."""
|
|
626
|
+
api_key, base = _resolve_client(require_key=False, silent=True)
|
|
627
|
+
if not api_key:
|
|
628
|
+
_err("Not logged in. You must be logged in to upload files.")
|
|
629
|
+
print(f" {_DM}Run {_C}akash login{_RS}{_DM} to log in, or set {_C}AKASH_API_KEY{_RS}{_DM}.{_RS}")
|
|
630
|
+
raise typer.Exit(1)
|
|
631
|
+
|
|
607
632
|
try:
|
|
608
|
-
client = AkashClient()
|
|
633
|
+
client = AkashClient(api_key=api_key, api_url=base)
|
|
609
634
|
uploader = VaultUploader(client)
|
|
610
635
|
all_files = [p for p in path.glob("**/*") if p.is_file() and not p.name.startswith(".")]
|
|
611
636
|
for i, file in enumerate(all_files, 1):
|
|
@@ -2008,8 +2033,14 @@ def send(
|
|
|
2008
2033
|
_ok(f"encrypted {_dim(f'{size_kb:.1f} KB → {enc_kb:.1f} KB')}")
|
|
2009
2034
|
|
|
2010
2035
|
# ── 4. Upload envelope ────────────────────────────────────────────────────
|
|
2036
|
+
api_key, base = _resolve_client(require_key=False, silent=True)
|
|
2037
|
+
if not api_key:
|
|
2038
|
+
_err("Not logged in. You must be logged in to send files.")
|
|
2039
|
+
print(f" {_DM}Run {_C}akash login{_RS}{_DM} to log in, or set {_C}AKASH_API_KEY{_RS}{_DM}.{_RS}")
|
|
2040
|
+
raise typer.Exit(1)
|
|
2041
|
+
|
|
2011
2042
|
try:
|
|
2012
|
-
client = AkashClient()
|
|
2043
|
+
client = AkashClient(api_key=api_key, api_url=base)
|
|
2013
2044
|
except Exception as e:
|
|
2014
2045
|
_err(f"not logged in: {e}")
|
|
2015
2046
|
raise typer.Exit(1)
|
|
@@ -2086,8 +2117,14 @@ def inbox(
|
|
|
2086
2117
|
_err(f"failed to load identity: {e}")
|
|
2087
2118
|
raise typer.Exit(1)
|
|
2088
2119
|
|
|
2120
|
+
api_key, base = _resolve_client(require_key=False, silent=True)
|
|
2121
|
+
if not api_key:
|
|
2122
|
+
_err("Not logged in. You must be logged in to view your inbox.")
|
|
2123
|
+
print(f" {_DM}Run {_C}akash login{_RS}{_DM} to log in, or set {_C}AKASH_API_KEY{_RS}{_DM}.{_RS}")
|
|
2124
|
+
raise typer.Exit(1)
|
|
2125
|
+
|
|
2089
2126
|
try:
|
|
2090
|
-
client = AkashClient()
|
|
2127
|
+
client = AkashClient(api_key=api_key, api_url=base)
|
|
2091
2128
|
except Exception as e:
|
|
2092
2129
|
_err(f"not logged in: {e}")
|
|
2093
2130
|
raise typer.Exit(1)
|
|
@@ -2264,8 +2301,14 @@ def pipe(
|
|
|
2264
2301
|
from .logger import log_op
|
|
2265
2302
|
import io
|
|
2266
2303
|
|
|
2304
|
+
api_key, base = _resolve_client(require_key=False, silent=True)
|
|
2305
|
+
if not api_key:
|
|
2306
|
+
_err("Not logged in. You must be logged in to pipe data to the cloud.")
|
|
2307
|
+
print(f" {_DM}Run {_C}akash login{_RS}{_DM} to log in, or set {_C}AKASH_API_KEY{_RS}{_DM}.{_RS}")
|
|
2308
|
+
raise typer.Exit(1)
|
|
2309
|
+
|
|
2267
2310
|
try:
|
|
2268
|
-
client = AkashClient()
|
|
2311
|
+
client = AkashClient(api_key=api_key, api_url=base)
|
|
2269
2312
|
except Exception as e:
|
|
2270
2313
|
_err(f"not logged in: {e}")
|
|
2271
2314
|
raise typer.Exit(1)
|
|
@@ -2644,8 +2687,14 @@ def env_push(
|
|
|
2644
2687
|
from .logger import log_op
|
|
2645
2688
|
import tempfile as _tf
|
|
2646
2689
|
|
|
2690
|
+
api_key, base = _resolve_client(require_key=False, silent=True)
|
|
2691
|
+
if not api_key:
|
|
2692
|
+
_err("Not logged in. You must be logged in to push environment variables.")
|
|
2693
|
+
print(f" {_DM}Run {_C}akash login{_RS}{_DM} to log in, or set {_C}AKASH_API_KEY{_RS}{_DM}.{_RS}")
|
|
2694
|
+
raise typer.Exit(1)
|
|
2695
|
+
|
|
2647
2696
|
try:
|
|
2648
|
-
client = AkashClient()
|
|
2697
|
+
client = AkashClient(api_key=api_key, api_url=base)
|
|
2649
2698
|
except Exception as e:
|
|
2650
2699
|
_err(f"not logged in: {e}")
|
|
2651
2700
|
raise typer.Exit(1)
|
|
@@ -2708,8 +2757,14 @@ def env_pull(
|
|
|
2708
2757
|
from .env_manager import env_save_blob
|
|
2709
2758
|
from .logger import log_op
|
|
2710
2759
|
|
|
2760
|
+
api_key, base = _resolve_client(require_key=False, silent=True)
|
|
2761
|
+
if not api_key:
|
|
2762
|
+
_err("Not logged in. You must be logged in to pull environment variables.")
|
|
2763
|
+
print(f" {_DM}Run {_C}akash login{_RS}{_DM} to log in, or set {_C}AKASH_API_KEY{_RS}{_DM}.{_RS}")
|
|
2764
|
+
raise typer.Exit(1)
|
|
2765
|
+
|
|
2711
2766
|
try:
|
|
2712
|
-
client = AkashClient()
|
|
2767
|
+
client = AkashClient(api_key=api_key, api_url=base)
|
|
2713
2768
|
except Exception as e:
|
|
2714
2769
|
_err(f"not logged in: {e}")
|
|
2715
2770
|
raise typer.Exit(1)
|
|
@@ -20,7 +20,7 @@ class AkashClient:
|
|
|
20
20
|
_patch_dns(_up(self.base_url).hostname or "")
|
|
21
21
|
|
|
22
22
|
if not self.api_key:
|
|
23
|
-
raise AuthenticationError("
|
|
23
|
+
raise AuthenticationError("User is not logged in. An API key is required. Run 'akash login' or set AKASH_API_KEY env var.")
|
|
24
24
|
|
|
25
25
|
def _get_headers(self, custom: dict = None):
|
|
26
26
|
h = {"x-api-key": self.api_key, "Origin": "https://akash.cli"}
|
|
@@ -379,6 +379,10 @@ def upload_large_file(
|
|
|
379
379
|
progress_cb: Optional[Callable[[int, int], None]] = None,
|
|
380
380
|
) -> dict:
|
|
381
381
|
from .uploader import VaultUploader
|
|
382
|
+
from .exceptions import AuthenticationError
|
|
383
|
+
|
|
384
|
+
if not getattr(client, "api_key", None):
|
|
385
|
+
raise AuthenticationError("User is not logged in. An API key is required to upload files. Run 'akash login'.")
|
|
382
386
|
|
|
383
387
|
size = path.stat().st_size
|
|
384
388
|
digest = sha256_file(path)
|
|
@@ -6,7 +6,7 @@ from pathlib import Path
|
|
|
6
6
|
from typing import Optional, Callable, List
|
|
7
7
|
from concurrent.futures import ThreadPoolExecutor
|
|
8
8
|
from .models import UploadResult
|
|
9
|
-
from .exceptions import UploadFailed, QuotaExceeded
|
|
9
|
+
from .exceptions import UploadFailed, QuotaExceeded, AuthenticationError
|
|
10
10
|
|
|
11
11
|
class VaultUploader:
|
|
12
12
|
def __init__(self, client):
|
|
@@ -26,6 +26,8 @@ class VaultUploader:
|
|
|
26
26
|
Standardizes both File and Text uploads into a single stream.
|
|
27
27
|
progress_callback signature: (bytes_read, total_bytes)
|
|
28
28
|
"""
|
|
29
|
+
if not getattr(self.client, "api_key", None):
|
|
30
|
+
raise AuthenticationError("User is not logged in. An API key is required to upload files. Run 'akash login'.")
|
|
29
31
|
|
|
30
32
|
# 1. Prepare Headers based on V3 Power-Control Specs
|
|
31
33
|
headers = {
|
|
@@ -220,6 +222,8 @@ class VaultUploader:
|
|
|
220
222
|
|
|
221
223
|
def upload_directory(self, folder_path: str, max_workers: int = 3) -> List[UploadResult]:
|
|
222
224
|
"""Recursively uploads all files in a folder using a thread pool."""
|
|
225
|
+
if not getattr(self.client, "api_key", None):
|
|
226
|
+
raise AuthenticationError("User is not logged in. An API key is required to upload files. Run 'akash login'.")
|
|
223
227
|
# Convert string path to Path object
|
|
224
228
|
root = Path(folder_path)
|
|
225
229
|
if not root.is_dir():
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|