Files
cli/rscli/main.py
T
elordenador 7f1cb97742 Add new dependencies and update existing packages in uv.lock
- Added `certifi` version 2026.4.22 and `charset-normalizer` version 3.4.7 with multiple wheel options.
- Introduced `idna` version 3.14 and `prettytable` version 3.17.0 with their respective wheel files.
- Updated `requests` to version 2.34.0, including its dependencies.
- Added `urllib3` version 2.7.0 and `wcwidth` version 0.7.0 with their wheel files.
- Updated `cli` package metadata to include new dependencies: `prettytable` and `requests`.
2026-05-12 18:39:03 +02:00

41 lines
947 B
Python
Executable File

#!/bin/env python
import typer, json, os, sys
from pathlib import Path
from .config import Config
from getpass import getpass
from prettytable import PrettyTable
import requests
VERSION = "1.0"
API_URI = "http://localhost:8080"
app = typer.Typer()
config = Config()
config.load()
@app.command()
def version():
print(f"Version: {VERSION}")
@app.command()
def login():
username: str = input("Username: ")
password: str = getpass("Password: ")
result = requests.post(API_URI+"/api/login/", json={"username":username, "password":password})
data = result.json()
table = PrettyTable()
table.field_names = ["Status Code", "Message"]
if result.status_code != 200:
table.add_row([result.status_code, data["detail"]])
else:
table.add_row([result.status_code, "success"])
config.set("token", data["access_token"])
config.save()
print(table)
if __name__ == "__main__":
app()