my-new-repo/gitea_read.py

19 lines
546 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import os
import requests
from dotenv import load_dotenv
# Загрузка переменных окружения из .env
load_dotenv()
# Получение токена из переменной окружения
TOKEN = os.getenv("GITEA_TOKEN")
# Заголовок авторизации
headers = {"Authorization": f"token {TOKEN}"}
# Запрос информации о пользователе
response = requests.get("https://git.vyatsu.ru/api/v1/user", headers=headers)
# Вывод результата
print(response.json())