Fix connections

This commit is contained in:
ashatora
2024-05-01 09:59:22 +03:00
parent c6ccebd4fe
commit 9a23c4554b
2 changed files with 8 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
{ {
"files": [], "files": [],
"url": "http://10.10.8.79:7001/xmlrpc", "url": "http://10.10.8.79:7000/xmlrpc",
"params": { "params": {
"from": "tcp://kptsp_vb", "from": "tcp://kptsp_vb",
"query_data": "<?xml version=\"1.0\" encoding=\"utf-8\"?><request><header parcel_id=\"990715ba919544a98f22cc7d3b0d9e8d\"/><getCatalog/></request>", "query_data": "<?xml version=\"1.0\" encoding=\"utf-8\"?><request><header parcel_id=\"990715ba919544a98f22cc7d3b0d9e8d\"/><getCatalog/></request>",

View File

@@ -77,11 +77,12 @@ def pika_callback(ch, method, properties, body):
files = [] files = []
for file in data['files']: for file in data['files']:
fn = os.path.join(gettempdir(), uuid4().hex) fn = os.path.join(gettempdir(), uuid4().hex)
download_file(file['name'], file['bucket'], fn) download_file(file['url']['name'], file['url']['bucket'], fn)
files.append(fn) file['url'] = fn
files.append(file)
run_task(params['query_type'], params, files, url) run_task(params['query_type'], params, files, url)
# except JSONDecodeError as e: except JSONDecodeError as e:
# logging.warning(e) logging.warning(e)
finally: finally:
ch.basic_ack(delivery_tag=method.delivery_tag) ch.basic_ack(delivery_tag=method.delivery_tag)
@@ -92,7 +93,8 @@ def send_response(params, files, url):
for file in files: for file in files:
fn = uuid4().hex fn = uuid4().hex
upload_file(file['url'], fn, Config.s3_bucket) upload_file(file['url'], fn, Config.s3_bucket)
files_s3.append({'name': fn, 'bucket': Config.s3_bucket}) file['url'] = {'name': fn, 'bucket': Config.s3_bucket}
files_s3.append(file)
data = { data = {
'params': params, 'params': params,
'files': files_s3, 'files': files_s3,