import dropbox
from dotenv import load_dotenv
from pathlib import Path
import os

load_dotenv(Path(__file__).parent / ".env")

APP_KEY = os.getenv("DROPBOX_APP_KEY", "")
APP_SECRET = os.getenv("DROPBOX_APP_SECRET", "")
REFRESH_TOKEN = os.getenv("DROPBOX_APP_REFRESH_TOKEN", "")

dbx = dropbox.Dropbox(
    app_key=APP_KEY,
    app_secret=APP_SECRET,
    oauth2_refresh_token=REFRESH_TOKEN,
)

dropbox_path = "/!!!Days/Downloads Z230/AHOJVLADO.TXT"
content = b"AHOJ VLADO"

dbx.files_upload(content, dropbox_path, mode=dropbox.files.WriteMode.overwrite)
print(f"Nahráno: {dropbox_path}")
