import requests
import os
from dotenv import load_dotenv

load_dotenv()

TOKEN = os.getenv("GITEA_WRITE_TOKEN")
if not TOKEN:
    raise Exception("Нет токена в .env")

headers = {"Authorization": f"token {TOKEN}"}

data = {
    "name": "exd3week",
    "description": "Публичный репозиторий через API",
    "private": False,
    "auto_init": True
}

response = requests.post("https://git.vyatsu.ru/api/v1/user/repos", json=data, headers=headers)

print("Status code:", response.status_code)
print("Text:", response.text)