26 lines
504 B
Python
26 lines
504 B
Python
import os
|
|
import requests
|
|
|
|
TOKEN = os.getenv("GITEA_TOKEN")
|
|
|
|
if not TOKEN:
|
|
raise ValueError("Нет токена")
|
|
|
|
url = "https://git.vyatsu.ru/api/v1/user/repos"
|
|
|
|
headers = {
|
|
"Authorization": f"token {TOKEN}",
|
|
"Content-Type": "application/json"
|
|
}
|
|
|
|
data = {
|
|
"name": "lab3-created-via-api",
|
|
"description": "repo created via API",
|
|
"private": False,
|
|
"auto_init": True
|
|
}
|
|
|
|
response = requests.post(url, headers=headers, json=data)
|
|
|
|
print(response.status_code)
|
|
print(response.text) |