diff --git a/.gitignore b/.gitignore index d7e4553..1f10dad 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .venv/ __pycache__/ *.pyc -output.txt \ No newline at end of file +output.txt +.env \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..6b76b4f --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python Debugger: Current File", + "type": "debugpy", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal" + } + ] +} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index c1d13ed..f1bb84a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,7 @@ certifi==2026.2.25 charset-normalizer==3.4.7 +dotenv==0.9.9 idna==3.11 +python-dotenv==1.2.2 requests==2.33.1 urllib3==2.6.3 diff --git a/work_with_api.py b/work_with_api.py new file mode 100644 index 0000000..1b9afec --- /dev/null +++ b/work_with_api.py @@ -0,0 +1,14 @@ +import os +import requests +from dotenv import load_dotenv +load_dotenv() +TOKEN = os.getenv("read_and_write") +headers = {"Authorization": f"token {TOKEN}"} +response = requests.get("https://git.vyatsu.ru/api/v1/user", headers=headers) +print(response.json()) +data = { + "name": "api_repo", + "description": "Создано через API", + "private": False, +} +requests.post("https://git.vyatsu.ru/api/v1/user/repos",headers=headers,json = data) \ No newline at end of file