fix sync webexporter
This commit is contained in:
BIN
deps/infra-0.2-py3-none-any.whl
vendored
BIN
deps/infra-0.2-py3-none-any.whl
vendored
Binary file not shown.
40
main.py
40
main.py
@@ -28,6 +28,7 @@ from sqlalchemy.orm import Session
|
|||||||
from fastapi import FastAPI, Response, Form, UploadFile, File, Request
|
from fastapi import FastAPI, Response, Form, UploadFile, File, Request
|
||||||
import uvicorn
|
import uvicorn
|
||||||
from typing import Annotated
|
from typing import Annotated
|
||||||
|
import pathlib
|
||||||
|
|
||||||
|
|
||||||
NEW_REPLICATION_REQUEST = 99
|
NEW_REPLICATION_REQUEST = 99
|
||||||
@@ -345,14 +346,49 @@ def get_metadata(params, files, url):
|
|||||||
|
|
||||||
|
|
||||||
def put_object(params, files, url):
|
def put_object(params, files, url):
|
||||||
pass
|
date = datetime.datetime.now()
|
||||||
|
req = ET.fromstring(params['query_data'])
|
||||||
|
obj = req.find('chart')
|
||||||
|
class_id = obj.get('Class')
|
||||||
|
con = OOConnectionParams(scheme, Config.oodb_host, Config.oodb_port, Config.oodb_dbname,
|
||||||
|
Config.oodb_username, Config.oodb_passwd, Config.oodb_schema)
|
||||||
|
ws = OODBWorkspace.ws(Config.oodb_schema)
|
||||||
|
if not ws.isInit():
|
||||||
|
res = ws.init(con)
|
||||||
|
logger.warning(res)
|
||||||
|
fc = ws.featureClass(class_id)
|
||||||
|
feature = fc.createFeature()
|
||||||
|
geom = Polygon.fromExtent(Envelope(0.0, 0.0, 1.0, 1.0, SRFactory.PZ9011()))
|
||||||
|
res = feature.setGeometry(geom)
|
||||||
|
for attr in obj.findall('Attribute'):
|
||||||
|
name = attr.get('name')
|
||||||
|
value = attr.get('value')
|
||||||
|
res &= feature.addAttribute(name, variantFromString(value))
|
||||||
|
|
||||||
|
assert len(files) == 1
|
||||||
|
file = files[0]
|
||||||
|
dir = TemporaryDirectory()
|
||||||
|
with zipfile.ZipFile(file, 'r') as zip_ref:
|
||||||
|
zip_ref.extractall(dir.name)
|
||||||
|
|
||||||
|
fp = pathlib.Path(dir.name)
|
||||||
|
for item in fp.glob('**/*'):
|
||||||
|
if not item.is_file():
|
||||||
|
continue
|
||||||
|
print(item.relative_to(dir.name))
|
||||||
|
print(os.path.getsize(item))
|
||||||
|
upload_file(str(item), uuid4().hex, Config.s3_bucket)
|
||||||
|
|
||||||
|
ws.transaction()
|
||||||
|
res = ws.save()
|
||||||
|
ws.commit(f'Putobject from {params["to"]}')
|
||||||
|
|
||||||
|
|
||||||
def apply_commits(params, files, url):
|
def apply_commits(params, files, url):
|
||||||
logger.warning(params, files, url)
|
logger.warning(params, files, url)
|
||||||
assert len(files) == 1
|
assert len(files) == 1
|
||||||
file = files[0]
|
file = files[0]
|
||||||
dir = TemporaryDirectory[str]
|
dir = TemporaryDirectory()
|
||||||
with zipfile.ZipFile(file, 'r') as zip_ref:
|
with zipfile.ZipFile(file, 'r') as zip_ref:
|
||||||
zip_ref.extractall(dir.name)
|
zip_ref.extractall(dir.name)
|
||||||
req = ET.fromstring(params['query_data'])
|
req = ET.fromstring(params['query_data'])
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
--find-links=deps
|
||||||
aiohttp==3.8.4
|
aiohttp==3.8.4
|
||||||
aiosignal==1.3.1
|
aiosignal==1.3.1
|
||||||
annotated-types==0.5.0
|
annotated-types==0.5.0
|
||||||
@@ -17,7 +18,7 @@ graphql-core==3.3.0a3
|
|||||||
greenlet==2.0.2
|
greenlet==2.0.2
|
||||||
h11==0.14.0
|
h11==0.14.0
|
||||||
idna==3.4
|
idna==3.4
|
||||||
infra @ file:///home/ashatora/PycharmProjects/xmlrpcserver/deps/infra-0.2-py3-none-any.whl#sha256=b4dae258fa13c1f60ea1fdf70466c7a374529cf4cdfdef76579a2a0f8022e2a3
|
infra
|
||||||
jmespath==1.0.1
|
jmespath==1.0.1
|
||||||
multidict==6.0.4
|
multidict==6.0.4
|
||||||
pika==1.3.2
|
pika==1.3.2
|
||||||
@@ -35,6 +36,6 @@ sniffio==1.3.0
|
|||||||
SQLAlchemy==2.0.20
|
SQLAlchemy==2.0.20
|
||||||
starlette==0.27.0
|
starlette==0.27.0
|
||||||
typing_extensions==4.7.1
|
typing_extensions==4.7.1
|
||||||
urllib3==2.0.4
|
urllib3==1.26
|
||||||
uvicorn==0.23.2
|
uvicorn==0.23.2
|
||||||
yarl==1.9.2
|
yarl==1.9.2
|
||||||
|
|||||||
Reference in New Issue
Block a user