33 lines
908 B
Python
33 lines
908 B
Python
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}") |