Gitea lab3
This commit is contained in:
parent
08d33e1080
commit
52e50ad7f7
20
gitea_api.py
Normal file
20
gitea_api.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import requests
|
||||||
|
import os
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
load_dotenv() # ← ЭТОГО У ТЕБЯ НЕТ
|
||||||
|
|
||||||
|
TOKEN = os.getenv("TOKEN")
|
||||||
|
|
||||||
|
print("TOKEN =", TOKEN) # для проверки
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
"Authorization": f"token {TOKEN}"
|
||||||
|
}
|
||||||
|
|
||||||
|
response = requests.get(
|
||||||
|
"https://git.vyatsu.ru/api/v1/user",
|
||||||
|
headers=headers
|
||||||
|
)
|
||||||
|
|
||||||
|
print(response.json())
|
||||||
Loading…
Reference in New Issue
Block a user