Добавил весь код
This commit is contained in:
parent
c8ff7fd3b7
commit
7e7c8c490c
2
.gitignore
vendored
2
.gitignore
vendored
@ -0,0 +1,2 @@
|
||||
.venv/
|
||||
.env
|
7
client.py
Normal file
7
client.py
Normal file
@ -0,0 +1,7 @@
|
||||
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()
|
9
client_3.py
Normal file
9
client_3.py
Normal file
@ -0,0 +1,9 @@
|
||||
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()
|
6
client_token.py
Normal file
6
client_token.py
Normal file
@ -0,0 +1,6 @@
|
||||
import requests
|
||||
|
||||
TOKEN = "a1814b99a824d3e7b835b257fe5d2c20906bceac"
|
||||
headers = {"Authorization": f"token {TOKEN}"}
|
||||
response = requests.get("https://git.vyatsu.ru/api/v1/user", headers=headers)
|
||||
print(response.json())
|
9
client_НЬЮ.py
Normal file
9
client_НЬЮ.py
Normal file
@ -0,0 +1,9 @@
|
||||
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()
|
10
server.py
Normal file
10
server.py
Normal file
@ -0,0 +1,10 @@
|
||||
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)
|
||||
print(f"Сообщение от {addr}: {data.decode()}")
|
||||
server.sendto(data.upper(), addr)
|
16
token_rw.py
Normal file
16
token_rw.py
Normal file
@ -0,0 +1,16 @@
|
||||
import requests
|
||||
from dotenv import load_dotenv
|
||||
import os
|
||||
|
||||
load_dotenv()
|
||||
TOKEN = os.getenv("GITEA_TOKEN_RW")
|
||||
headers = {"Authorization": f"token {TOKEN}"}
|
||||
|
||||
data = {
|
||||
"name": "3laba_API_poluchaetsa",
|
||||
"private": False,
|
||||
"description": "Репо появившийся с помощью API"
|
||||
}
|
||||
|
||||
response = requests.post("https://git.vyatsu.ru/api/v1/user/repos", headers=headers, json=data)
|
||||
print(response.json())
|
10
toren_read.py
Normal file
10
toren_read.py
Normal file
@ -0,0 +1,10 @@
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
import requests
|
||||
|
||||
load_dotenv()
|
||||
|
||||
TOKEN = os.getenv("GITEA_TOKEN")
|
||||
headers = {"Authorization": f"token {TOKEN}"}
|
||||
response = requests.get("https://git.vyatsu.ru/api/v1/user", headers=headers)
|
||||
print(response.json())
|
BIN
~$кумент Microsoft Word.docx
Normal file
BIN
~$кумент Microsoft Word.docx
Normal file
Binary file not shown.
BIN
~WRL0005.tmp
Normal file
BIN
~WRL0005.tmp
Normal file
Binary file not shown.
BIN
Документ Microsoft Word.docx
Normal file
BIN
Документ Microsoft Word.docx
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user