Compare commits
10 Commits
Author | SHA1 | Date |
---|---|---|
|
38a3daa0a9 | |
|
4ce34a3f67 | |
|
477842ca89 | |
|
4ef58909ed | |
|
f457d75335 | |
|
5bc071d25b | |
|
3ccca24bab | |
|
995870bb15 | |
|
5df8d9b081 | |
|
08b6d444ce |
|
@ -0,0 +1,3 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
|
@ -0,0 +1,10 @@
|
|||
<?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="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,12 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="ignoredIdentifiers">
|
||||
<list>
|
||||
<option value="final.test1.test1.urls.app01" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
|
@ -0,0 +1,6 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (Storage)" project-jdk-type="Python SDK" />
|
||||
<component name="PyCharmProfessionalAdvertiser">
|
||||
<option name="shown" value="true" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/Storage.iml" filepath="$PROJECT_DIR$/.idea/Storage.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,97 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="28c1fcb2-d037-4417-a65b-089aaaab43a2" name="Changes" comment="" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Python Script" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="MarkdownSettingsMigration">
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="ProjectId" id="2Od7VcrPSK3ug44vWgOEWtHcVng" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
</component>
|
||||
<component name="RunManager" selected="Python.test">
|
||||
<configuration name="main" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
|
||||
<module name="Storage" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/main.py" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="test" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||
<module name="Storage" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/test.py" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Python.test" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="28c1fcb2-d037-4417-a65b-089aaaab43a2" name="Changes" comment="" />
|
||||
<created>1681878629982</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1681878629982</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
||||
<url>file://$PROJECT_DIR$/main.py</url>
|
||||
<line>8</line>
|
||||
<option name="timeStamp" value="1" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,30 @@
|
|||
import datetime
|
||||
import threading
|
||||
import time
|
||||
|
||||
import pika
|
||||
user = pika.PlainCredentials("id", "pwd")
|
||||
parameters = pika.ConnectionParameters("172.20.80.100", credentials=user)
|
||||
connection = pika.BlockingConnection(parameters)
|
||||
index = 0
|
||||
data_server = {}
|
||||
def func():
|
||||
while True:
|
||||
now = int(datetime.datetime.now().timestamp())
|
||||
for k, v in data_server.items():
|
||||
if (now - v)>3:
|
||||
del data_server[k]
|
||||
time.sleep(1)
|
||||
if __name__ == '__main__':
|
||||
threading.Timer(1, func).start()
|
||||
channel = connection.channel()
|
||||
for method_frame, properties, body in channel.consume("mch"):
|
||||
try:
|
||||
ip, port = str(body).split(':')
|
||||
data_server[ip] = int(datetime.datetime.now().timestamp())
|
||||
print(data_server)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
connection.close()
|
||||
|
||||
connection.close()
|
|
@ -0,0 +1,15 @@
|
|||
import time
|
||||
|
||||
import pika
|
||||
user = pika.PlainCredentials("id", "pwd")
|
||||
parameters = pika.ConnectionParameters("172.20.80.100", credentials=user)
|
||||
connection = pika.BlockingConnection(parameters)
|
||||
|
||||
if __name__ == '__main__':
|
||||
channel = connection.channel()
|
||||
# channel.queue_declare(queue="mch", durable=True)
|
||||
channel.queue_bind(exchange="test", queue="mch", routing_key="mch")
|
||||
while True:
|
||||
body = "ip:port"
|
||||
channel.basic_publish(exchange='test', routing_key='mch', body=body)
|
||||
time.sleep(3)
|
|
@ -0,0 +1,16 @@
|
|||
# This is a sample Python script.
|
||||
|
||||
# Press Shift+F10 to execute it or replace it with your code.
|
||||
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
|
||||
|
||||
|
||||
def print_hi(name):
|
||||
# Use a breakpoint in the code line below to debug your script.
|
||||
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
|
||||
|
||||
|
||||
# Press the green button in the gutter to run the script.
|
||||
if __name__ == '__main__':
|
||||
print_hi('PyCharm')
|
||||
|
||||
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
|
|
@ -0,0 +1,39 @@
|
|||
from flask import Flask, request, send_file
|
||||
from flask_restful import Resource, Api, reqparse
|
||||
import os
|
||||
|
||||
app = Flask(__name__)
|
||||
api = Api(app)
|
||||
app = Flask(__name__)
|
||||
api = Api(app)
|
||||
|
||||
|
||||
class ObjectStorage(Resource):
|
||||
|
||||
def put(self, object_name):
|
||||
file = request.files['file']
|
||||
file.save(object_name)
|
||||
return {'status': 'success'}
|
||||
|
||||
def get(self, object_name):
|
||||
file = open(object_name, 'rb')
|
||||
return send_file(file, mimetype='application/octet-stream')
|
||||
|
||||
def delete(self, object_name):
|
||||
os.remove(object_name)
|
||||
|
||||
|
||||
|
||||
api.add_resource(ObjectStorage,'/objects/<string:object_name>')
|
||||
|
||||
|
||||
@app.route("/")
|
||||
def hello():
|
||||
return "Hello World!"
|
||||
|
||||
@app.route("/1")
|
||||
def hello2():
|
||||
return "Hello aaaaa World!"
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run()
|
Loading…
Reference in New Issue