Compare commits

..

No commits in common. "0112a5b4e396f55f77aa783898441364e334f262" and "64269300999807e924a740f39a4169c79bae7cd2" have entirely different histories.

13 changed files with 0 additions and 153 deletions

2
.gitignore vendored
View File

@ -159,6 +159,4 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.venv
.env

5
practic03/.idea/.gitignore generated vendored
View File

@ -1,5 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/

View File

@ -1,6 +0,0 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.12 (practic03)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (practic03)" project-jdk-type="Python SDK" />
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/practic03.iml" filepath="$PROJECT_DIR$/.idea/practic03.iml" />
</modules>
</component>
</project>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.12 (practic03)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,55 +0,0 @@
import os
import requests
from dotenv import load_dotenv
# 1. Загружаем токен из файла .env
load_dotenv()
TOKEN = os.getenv("GITEA_TOKEN")
if not TOKEN:
print(" Ошибка: Токен не найден! Проверь файл .env")
exit()
# Заголовки для авторизации (стандарт Gitea)
headers = {
"Authorization": f"token {TOKEN}",
"Content-Type": "application/json"
}
def check_user():
print("--- Шаг 1: Проверка профиля ---")
url = "https://git.vyatsu.ru/api/v1/user"
response = requests.get(url, headers=headers)
if response.status_code == 200:
data = response.json()
print(f" Успешный вход! Логин: {data.get('login')}")
else:
print(f" Ошибка авторизации: {response.status_code}")
def create_repo(repo_name):
print(f"\n--- Шаг 2: Создание репозитория '{repo_name}' ---")
url = "https://git.vyatsu.ru/api/v1/user/repos"
payload = {
"name": repo_name,
"description": "Лабораторная работа по сетям",
"private": False,
"auto_init": True # Создаст сразу README.md
}
response = requests.post(url, headers=headers, json=payload)
if response.status_code == 201:
print(f" Репозиторий создан: {response.json().get('html_url')}")
elif response.status_code == 422:
print(" Репозиторий с таким именем уже существует.")
else:
print(f" Что-то пошло не так: {response.text}")
if __name__ == "__main__":
check_user()
# В названии репозитория укажи что-то уникальное, чтобы не пересекаться с другими
create_repo("NIMER3")

View File

@ -1,5 +0,0 @@
import requests
response = requests.get("http://vyatsu.ru")
print(response.status_code)
print(response.text[:500])

View File

@ -1,9 +0,0 @@
import socket
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(('vyatsu.ru', 80))
request = "GET / HTTP/1.1\r\nHost: vyatsu.ru\r\n\r\n"
client.sendall(request.encode())
response = client.recv(4096)
print(response.decode())
client.close()

View File

@ -1,8 +0,0 @@
import socket
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(('127.0.0.1', 10000))
client.sendall(b'hello server11')
data = client.recv(1024)
print(f"Ответ от сервера: {data.decode()}")
client.close()

View File

@ -1,21 +0,0 @@
import socket
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(("0.0.0.0", 10000))
server.listen(1)
print("TCP сервер запущен")
while True:
conn, addr = server.accept()
print(f"Подключение от {addr}")
data = conn.recv(1024)
if not data:
break
conn.sendall(data.upper())
conn.close()
if data.upper() == b'EXIT':
break

View File

@ -1,10 +0,0 @@
import socket
server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server.bind(('0.0.0.0', 10000))
print("UDP сервер запущен")
while True:
data, addr = server.recvfrom(1024)
print(f"Сообщение от {addr}: {data.decode()}")
server.sendto(data.upper(), addr)

View File

@ -1,7 +0,0 @@
import socket
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
client.sendto(b'hello server', ('127.0.0.1', 10001))
data, _ = client.recvfrom(1024)
print(f"Ответ от сервера: {data.decode()}")
client.close()