добавлен файл на создание репозитория и библиотеки
This commit is contained in:
parent
a896be6e66
commit
dbf88b714b
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.venv/
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
.env
|
||||||
0
gitea_create_comment.py
Normal file
0
gitea_create_comment.py
Normal file
25
gitea_create_repo.py
Normal file
25
gitea_create_repo.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import os
|
||||||
|
import requests
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
TOKEN = os.getenv("GITEA_WRITE_TOKEN")
|
||||||
|
BASE_URL = os.getenv("GITEA_BASE_URL", "https://git.vyatsu.ru")
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
"Authorization": f"token {TOKEN}",
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
data = {
|
||||||
|
"name": "third-work-network-python",
|
||||||
|
"description": "Третья работа по сетевым соединениям в Python",
|
||||||
|
"private": False,
|
||||||
|
"auto_init": True
|
||||||
|
}
|
||||||
|
|
||||||
|
response = requests.post(f"{BASE_URL}/api/v1/user/repos", headers=headers, json=data)
|
||||||
|
|
||||||
|
print("Статус:", response.status_code)
|
||||||
|
print(response.json())
|
||||||
@ -11,7 +11,7 @@ headers = {
|
|||||||
"Authorization": f"token {TOKEN}"
|
"Authorization": f"token {TOKEN}"
|
||||||
}
|
}
|
||||||
|
|
||||||
response = requests.get("https://git.vyatsu.ru/api/v1/user", headers=headers)
|
response = requests.get("https://git.vyatsu.ru/stud203989/2zadaniepraktiki/issues/1", headers=headers)
|
||||||
|
|
||||||
print(response.status_code)
|
print(response.status_code)
|
||||||
print(response.json())
|
print(response.json())
|
||||||
BIN
requirements.txt
Normal file
BIN
requirements.txt
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user