From 8807a7650c5024bf1d3d8ac9c519e9a0e6226905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80?= Date: Mon, 4 May 2026 22:15:50 +0300 Subject: [PATCH] API Gitea: token 2 --- API Gitea/Gitea2.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 API Gitea/Gitea2.py diff --git a/API Gitea/Gitea2.py b/API Gitea/Gitea2.py new file mode 100644 index 0000000..cbefc0c --- /dev/null +++ b/API Gitea/Gitea2.py @@ -0,0 +1,33 @@ +import requests +import os +from dotenv import load_dotenv + +load_dotenv() + +TOKEN = os.getenv("GITEA_TOKEN2") +headers = { + "Authorization": f"token {TOKEN}", + "Content-Type": "application/json" +} + +# Эндпоинт для изменения своих настроек +profile_data = { + "full_name": "Александр Костюкин (изменено через API)", + "description": "Мой профиль, который я поменял через API Gitea", + "language": "ru-ru", + "website": "https://git.vyatsu.ru/stud203797", + "location": "Киров, Россия" +} + +response = requests.patch( + "https://git.vyatsu.ru/api/v1/user/settings", + headers=headers, + json=profile_data +) + +print(f"Status: {response.status_code}") +if response.status_code == 200: + print("Profile updated successfully") + print(response.json()) +else: + print(f"Error: {response.text}") \ No newline at end of file