From 313c2d197b81820c57e88d1c80a2bcbaf2698ac6 Mon Sep 17 00:00:00 2001 From: stud204007 Date: Tue, 28 Apr 2026 19:51:06 +0300 Subject: [PATCH] =?UTF-8?q?5=20=D1=87=D0=B0=D1=81=D1=82=D1=8C:=20=D0=A0?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=20=D1=81=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- requirements.txt | 1 + src/work_with_api.py | 12 ++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/work_with_api.py diff --git a/.gitignore b/.gitignore index 2a585e0..8f0d76c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .venv/ __pycache__/ -*.pyc \ No newline at end of file +*.pyc +.env \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index ed41b5e..93d925e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ certifi==2026.4.22 charset-normalizer==3.4.7 idna==3.13 +python-dotenv==1.2.2 requests==2.33.1 urllib3==2.6.3 diff --git a/src/work_with_api.py b/src/work_with_api.py new file mode 100644 index 0000000..ca6f21a --- /dev/null +++ b/src/work_with_api.py @@ -0,0 +1,12 @@ +import requests +import os +from dotenv import load_dotenv + +load_dotenv() +TOKEN = os.getenv("GITEA_TOKEN") + +headers = {"Authorization": f"token {TOKEN}"} +url = "https://git.vyatsu.ru/api/v1/user/repos" +data = {"name": "repository_created_API", "private": False} +response = requests.post(url, headers=headers, json=data) +print(response.json()) \ No newline at end of file