Compare commits
2
Commits
master
..
6353bab6bd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6353bab6bd | ||
|
|
96e67e65d9 |
+160
-1
@@ -1,3 +1,162 @@
|
|||||||
.venv/
|
# ---> Python
|
||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# C extensions
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Distribution / packaging
|
||||||
|
.Python
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
wheels/
|
||||||
|
share/python-wheels/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
MANIFEST
|
||||||
|
|
||||||
|
# PyInstaller
|
||||||
|
# Usually these files are written by a python script from a template
|
||||||
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
|
*.manifest
|
||||||
|
*.spec
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
pip-delete-this-directory.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
htmlcov/
|
||||||
|
.tox/
|
||||||
|
.nox/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
.cache
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
*.cover
|
||||||
|
*.py,cover
|
||||||
|
.hypothesis/
|
||||||
|
.pytest_cache/
|
||||||
|
cover/
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
*.pot
|
||||||
|
|
||||||
|
# Django stuff:
|
||||||
|
*.log
|
||||||
|
local_settings.py
|
||||||
|
db.sqlite3
|
||||||
|
db.sqlite3-journal
|
||||||
|
|
||||||
|
# Flask stuff:
|
||||||
|
instance/
|
||||||
|
.webassets-cache
|
||||||
|
|
||||||
|
# Scrapy stuff:
|
||||||
|
.scrapy
|
||||||
|
|
||||||
|
# Sphinx documentation
|
||||||
|
docs/_build/
|
||||||
|
|
||||||
|
# PyBuilder
|
||||||
|
.pybuilder/
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Jupyter Notebook
|
||||||
|
.ipynb_checkpoints
|
||||||
|
|
||||||
|
# IPython
|
||||||
|
profile_default/
|
||||||
|
ipython_config.py
|
||||||
|
|
||||||
|
# pyenv
|
||||||
|
# For a library or package, you might want to ignore these files since the code is
|
||||||
|
# intended to run in multiple environments; otherwise, check them in:
|
||||||
|
# .python-version
|
||||||
|
|
||||||
|
# pipenv
|
||||||
|
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||||
|
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||||
|
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||||
|
# install all needed dependencies.
|
||||||
|
#Pipfile.lock
|
||||||
|
|
||||||
|
# poetry
|
||||||
|
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||||
|
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||||
|
# commonly ignored for libraries.
|
||||||
|
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||||
|
#poetry.lock
|
||||||
|
|
||||||
|
# pdm
|
||||||
|
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||||
|
#pdm.lock
|
||||||
|
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||||
|
# in version control.
|
||||||
|
# https://pdm.fming.dev/#use-with-ide
|
||||||
|
.pdm.toml
|
||||||
|
|
||||||
|
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||||
|
__pypackages__/
|
||||||
|
|
||||||
|
# Celery stuff
|
||||||
|
celerybeat-schedule
|
||||||
|
celerybeat.pid
|
||||||
|
|
||||||
|
# SageMath parsed files
|
||||||
|
*.sage.py
|
||||||
|
|
||||||
|
# Environments
|
||||||
.env
|
.env
|
||||||
|
.venv
|
||||||
|
env/
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
|
env.bak/
|
||||||
|
venv.bak/
|
||||||
|
|
||||||
|
# Spyder project settings
|
||||||
|
.spyderproject
|
||||||
|
.spyproject
|
||||||
|
|
||||||
|
# Rope project settings
|
||||||
|
.ropeproject
|
||||||
|
|
||||||
|
# mkdocs documentation
|
||||||
|
/site
|
||||||
|
|
||||||
|
# mypy
|
||||||
|
.mypy_cache/
|
||||||
|
.dmypy.json
|
||||||
|
dmypy.json
|
||||||
|
|
||||||
|
# Pyre type checker
|
||||||
|
.pyre/
|
||||||
|
|
||||||
|
# pytype static type analyzer
|
||||||
|
.pytype/
|
||||||
|
|
||||||
|
# Cython debug symbols
|
||||||
|
cython_debug/
|
||||||
|
|
||||||
|
# PyCharm
|
||||||
|
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||||
|
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||||
|
# 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/
|
||||||
|
|
||||||
|
|||||||
Generated
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectModuleManager">
|
<component name="ProjectModuleManager">
|
||||||
<modules>
|
<modules>
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/PythonProject1.iml" filepath="$PROJECT_DIR$/.idea/PythonProject1.iml" />
|
<module fileurl="file://$PROJECT_DIR$/.idea/MyPractice.iml" filepath="$PROJECT_DIR$/.idea/MyPractice.iml" />
|
||||||
</modules>
|
</modules>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="VcsDirectoryMappings">
|
<component name="VcsDirectoryMappings">
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
<mapping directory="" vcs="Git" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
import requests
|
|
||||||
import os
|
|
||||||
import urllib3
|
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
# 1. Отключаем предупреждения и загружаем переменные
|
|
||||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
|
||||||
load_dotenv()
|
|
||||||
|
|
||||||
# 2. Берем токен из переменной окружения
|
|
||||||
TOKEN = os.getenv("GITEA_TOKEN")
|
|
||||||
|
|
||||||
# 3. Проверка: если токен не подгрузился, программа выдаст понятную ошибку
|
|
||||||
if not TOKEN:
|
|
||||||
raise ValueError("Ошибка: Токен не найден! Проверь файл .env")
|
|
||||||
|
|
||||||
headers = {"Authorization": f"token {TOKEN}"}
|
|
||||||
url = "https://git.vyatsu.ru/api/v1/user"
|
|
||||||
|
|
||||||
# 4. Выполняем запрос
|
|
||||||
response = requests.get(url, headers=headers, verify=False)
|
|
||||||
|
|
||||||
if response.status_code == 200:
|
|
||||||
print("Успех! Данные подгружены безопасно.")
|
|
||||||
print(response.json())
|
|
||||||
else:
|
|
||||||
print(f"Ошибка: {response.status_code}")
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
import os
|
|
||||||
import requests
|
|
||||||
from dotenv import load_dotenv
|
|
||||||
load_dotenv()
|
|
||||||
|
|
||||||
TOKEN = os.getenv("GITEA_TOKEN")
|
|
||||||
if not TOKEN:
|
|
||||||
raise Exception("Переменной окружения нет")
|
|
||||||
|
|
||||||
headers = {
|
|
||||||
"Authorization": f"token {TOKEN}",
|
|
||||||
"Content-Type": "application/json"
|
|
||||||
}
|
|
||||||
|
|
||||||
owner = "stud203804"
|
|
||||||
repo = "MyPractice"
|
|
||||||
|
|
||||||
url = f"https://git.vyatsu.ru/api/v1/repos/{owner}/{repo}/issues"
|
|
||||||
|
|
||||||
data = {
|
|
||||||
"title": "тестовая задача по практике",
|
|
||||||
"body" : "Создано через API Gitea с токеном на запись",
|
|
||||||
"labels": []
|
|
||||||
}
|
|
||||||
|
|
||||||
response = requests.post(url, headers=headers, json=data)
|
|
||||||
|
|
||||||
if response.status_code == 201:
|
|
||||||
print("Issue создан:")
|
|
||||||
print(response.json()["html_url"])
|
|
||||||
else:
|
|
||||||
print("error:", response.status_code)
|
|
||||||
print(response.text)
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
import requests
|
|
||||||
|
|
||||||
response = requests.get("http://vyatsu.ru")
|
|
||||||
print(response.text[:500])
|
|
||||||
-15
@@ -1,15 +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"
|
|
||||||
"User-Agent: python-requests/2.33.1\r\n"
|
|
||||||
"Accept: */*\r\n"
|
|
||||||
"\r\n"
|
|
||||||
)
|
|
||||||
client.sendall(request.encode())
|
|
||||||
response = client.recv(4096)
|
|
||||||
print(response.decode())
|
|
||||||
client.close()
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import math
|
|
||||||
def lcm(a: int, b: int) -> int:
|
|
||||||
if a == 0 or b == 0:
|
|
||||||
return 0
|
|
||||||
return abs(a * b) // math.gcd(a, b)
|
|
||||||
if __name__ == "__main__":
|
|
||||||
num1 = 4
|
|
||||||
num2 = 6
|
|
||||||
result = lcm(num1, num2)
|
|
||||||
print(f"Наибольшее общее кратное двух чисел {num1} и {num2} равно {result}")
|
|
||||||
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
"C:\Program Files\Python314\python.exe" C:\Users\USER\PycharmProjects\PythonProject1\main.py
|
|
||||||
Наибольшее общее кратное двух чисел 4 и 6 равно 12
|
|
||||||
|
|
||||||
Process finished with exit code 0
|
|
||||||
@@ -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'EXIT')
|
|
||||||
data = client.recv(1024)
|
|
||||||
print(f"Ответ от сервера: {data.decode()}")
|
|
||||||
client.close()
|
|
||||||
@@ -1,31 +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:
|
|
||||||
conn.close()
|
|
||||||
break
|
|
||||||
|
|
||||||
conn.sendall(data.upper())
|
|
||||||
|
|
||||||
conn.close()
|
|
||||||
|
|
||||||
if data.upper() == b'EXIT':
|
|
||||||
print("Завершение работы сервера...")
|
|
||||||
break
|
|
||||||
|
|
||||||
|
|
||||||
server.close()
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import socket
|
|
||||||
|
|
||||||
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
||||||
message = b'hello server'
|
|
||||||
client.sendto(message, ('127.0.0.1', 15000))
|
|
||||||
|
|
||||||
data, server_addr = client.recvfrom(1024)
|
|
||||||
print(f"Ответ от сервера: {data.decode()}")
|
|
||||||
|
|
||||||
client.close()
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
import socket
|
|
||||||
|
|
||||||
server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
||||||
server.bind(('0.0.0.0', 15000))
|
|
||||||
print("UDP сервер запущен на порту 15000")
|
|
||||||
|
|
||||||
while True:
|
|
||||||
data, addr = server.recvfrom(1024)
|
|
||||||
message = data.decode()
|
|
||||||
print(f"Получено от {addr}: {message}")
|
|
||||||
|
|
||||||
modified_message = f"ECHO: {message.upper()} (len: {len(message)})"
|
|
||||||
|
|
||||||
|
|
||||||
server.sendto(modified_message.encode(), addr)
|
|
||||||
Reference in New Issue
Block a user