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