Compare commits
No commits in common. "c4617b05ae4ba8f6b712d018671b56164e71c767" and "main" have entirely different histories.
c4617b05ae
...
main
9
.gitignore
vendored
9
.gitignore
vendored
@ -1,9 +0,0 @@
|
|||||||
venv/
|
|
||||||
.env/
|
|
||||||
__pycache__/
|
|
||||||
*.pyc
|
|
||||||
.vscode/
|
|
||||||
.idea/
|
|
||||||
*.log
|
|
||||||
api_git_example.py
|
|
||||||
token.py
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
import requests
|
|
||||||
|
|
||||||
TOKEN = "GIT_VYATSU_TOKEN1"
|
|
||||||
headers = {"Authorization": f"token {TOKEN}"}
|
|
||||||
response = requests.get("https://git.vyatsu.ru/api/v1/user", headers=headers)
|
|
||||||
print(response.json())
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
import os
|
|
||||||
import requests
|
|
||||||
|
|
||||||
TOKEN = os.getenv("GITEA_WRITE_TOKEN")
|
|
||||||
headers = {
|
|
||||||
"Authorization": f"token {TOKEN}",
|
|
||||||
"Content-Type": "application/json"
|
|
||||||
}
|
|
||||||
|
|
||||||
data = {
|
|
||||||
"name": "lab3-api-repo",
|
|
||||||
"description": "Репозиторий создан через Gitea API",
|
|
||||||
"private": False,
|
|
||||||
"auto_init": True
|
|
||||||
}
|
|
||||||
|
|
||||||
response = requests.post("https://git.vyatsu.ru/api/v1/user/repos", json=data, headers=headers)
|
|
||||||
print(response.status_code)
|
|
||||||
print(response.json())
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
import os
|
|
||||||
import requests
|
|
||||||
|
|
||||||
TOKEN = os.getenv("GITEA_READ_TOKEN")
|
|
||||||
|
|
||||||
if not TOKEN:
|
|
||||||
raise RuntimeError("Переменная окружения GITEA_READ_TOKEN не задана")
|
|
||||||
|
|
||||||
headers = {"Authorization": f"token {TOKEN}"}
|
|
||||||
response = requests.get("https://git.vyatsu.ru/api/v1/user", headers=headers)
|
|
||||||
|
|
||||||
print(response.status_code)
|
|
||||||
print(response.text)
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
import socket
|
|
||||||
|
|
||||||
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
||||||
client.connect(("vyatsu.ru", 80))
|
|
||||||
|
|
||||||
request = (
|
|
||||||
"GET / HTTP/1.1\r\n"
|
|
||||||
"Host: vyatsu.ru\r\n"
|
|
||||||
"Connection: close\r\n"
|
|
||||||
"\r\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
client.sendall(request.encode("utf-8"))
|
|
||||||
response = client.recv(4096)
|
|
||||||
print(response.decode(errors="ignore"))
|
|
||||||
|
|
||||||
client.close()
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
import requests
|
|
||||||
|
|
||||||
response = requests.get("http://vyatsu.ru")
|
|
||||||
print(response.text[:500])
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
import socket
|
|
||||||
|
|
||||||
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
||||||
client.connect(("127.0.0.1", 12000))
|
|
||||||
|
|
||||||
message = "hello server"
|
|
||||||
client.sendall(message.encode())
|
|
||||||
|
|
||||||
data = client.recv(1024)
|
|
||||||
print(f"Ответ от сервера: {data.decode()}")
|
|
||||||
|
|
||||||
client.close()
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
import socket
|
|
||||||
|
|
||||||
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
||||||
server.bind(("0.0.0.0", 12000))
|
|
||||||
server.listen(1)
|
|
||||||
|
|
||||||
print("TCP сервер запущен и ожидает подключения...")
|
|
||||||
|
|
||||||
while True:
|
|
||||||
conn, addr = server.accept()
|
|
||||||
print(f"Подключение от {addr}")
|
|
||||||
|
|
||||||
data = conn.recv(1024)
|
|
||||||
if not data:
|
|
||||||
conn.close()
|
|
||||||
continue
|
|
||||||
|
|
||||||
message = data.decode()
|
|
||||||
print(f"Получено сообщение: {message}")
|
|
||||||
|
|
||||||
response = message.upper()
|
|
||||||
conn.sendall(response.encode())
|
|
||||||
|
|
||||||
conn.close()
|
|
||||||
|
|
||||||
if response == "EXIT":
|
|
||||||
print("Сервер завершает работу")
|
|
||||||
break
|
|
||||||
|
|
||||||
server.close()
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
import socket
|
|
||||||
|
|
||||||
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
||||||
|
|
||||||
message = "привет сервер"
|
|
||||||
client.sendto(message.encode(), ("127.0.0.1", 10001))
|
|
||||||
|
|
||||||
data, _ = client.recvfrom(1024)
|
|
||||||
print(f"Ответ от сервера: {data.decode()}")
|
|
||||||
|
|
||||||
client.close()
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
import socket
|
|
||||||
|
|
||||||
server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
||||||
server.bind(("0.0.0.0", 10001))
|
|
||||||
|
|
||||||
print("UDP сервер запущен и ожидает сообщения...")
|
|
||||||
|
|
||||||
while True:
|
|
||||||
data, addr = server.recvfrom(1024)
|
|
||||||
message = data.decode()
|
|
||||||
print(f"Сообщение от {addr}: {message}")
|
|
||||||
|
|
||||||
response = message.upper()
|
|
||||||
server.sendto(response.encode(), addr)
|
|
||||||
Loading…
Reference in New Issue
Block a user