File tree Expand file tree Collapse file tree 4 files changed +48
-0
lines changed
Expand file tree Collapse file tree 4 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ API_TOKEN = 62ce13fb948ae0551c0512e14059000ffa35be64
Original file line number Diff line number Diff line change 1+ # Инструкция по запуску клиента Forgejo
2+
3+ ## Описание
4+
5+ Этот скрипт позволяет получать информацию о репозиториях на платформе Forgejo:
6+
7+ - Название репозитория
8+
9+ - Описание
10+
11+ ## Установка зависимостей
12+
13+ Перед началом работы установите необходимые библиотеки:
14+
15+ ``` pip install -r requirements.txt ```
16+
17+ ## Настройка API-токена
18+
19+ Создайте .env файл с токеном pyforgejo в рабочей папке скрипта. Пример находится в папке с клиентом.
20+
21+ ```
22+ API_TOKEN=62ce13fb948ae0551c0512e14059000ffa35be64
23+ ```
24+
25+ ## Запуск скрипта
26+
27+ Запустите скрипт командой:
28+
29+ ``` python main.py ```
30+
Original file line number Diff line number Diff line change 1+ from dotenv import dotenv_values
2+ from pyforgejo import PyforgejoApi
3+
4+ config = dotenv_values (".env" )
5+
6+ if not "API_TOKEN" in config :
7+ print ("Cannot find API_TOKEN in .env file. Check if it exists and has correct token. Aborting..." )
8+ exit (1 )
9+ client = PyforgejoApi (base_url = "https://codeberg.org/api/v1" , api_key = config ["API_TOKEN" ])
10+
11+ repo = client .repository .repo_get (owner = "harabat" , repo = "pyforgejo" )
12+
13+
14+ print (f"Название: { repo .name } " )
15+ print (f"Описание: { repo .description } " )
Original file line number Diff line number Diff line change 1+ pyforgejo == 2.0.0
2+ python-dotenv == 1.0.1
You can’t perform that action at this time.
0 commit comments