feat: add gitea api request

This commit is contained in:
Артём Садаков 2026-05-07 16:26:29 +03:00
parent 2c0055136b
commit 179f019121
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,34 @@
import os
import requests
from dotenv import load_dotenv
def main():
load_dotenv()
token = os.getenv("GITEA_TOKEN")
if not token:
print("Ошибка: токен Gitea не найден. Проверьте файл .env")
return
url = "https://git.vyatsu.ru/api/v1/user"
headers = {
"Authorization": f"token {token}"
}
response = requests.get(url, headers=headers)
print("Статус-код:", response.status_code)
try:
print("Ответ API:")
print(response.json())
except ValueError:
print("Ответ сервера:")
print(response.text)
if __name__ == "__main__":
main()

Binary file not shown.