OpenGeodeWeb-Back 3.0.0rc12__py3-none-any.whl → 3.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {OpenGeodeWeb_Back-3.0.0rc12.dist-info → OpenGeodeWeb_Back-3.2.0.dist-info}/METADATA +2 -1
- OpenGeodeWeb_Back-3.2.0.dist-info/RECORD +16 -0
- opengeodeweb_back/geode_functions.py +2 -3
- opengeodeweb_back/routes/blueprint_routes.py +178 -0
- opengeodeweb_back/routes/schemas/allowed_files.json +20 -0
- opengeodeweb_back/routes/schemas/allowed_objects.json +16 -0
- opengeodeweb_back/routes/schemas/geode_objects_and_output_extensions.json +21 -0
- opengeodeweb_back/routes/schemas/geographic_coordinate_systems.json +17 -0
- opengeodeweb_back/routes/schemas/missing_files.json +16 -0
- opengeodeweb_back/routes/schemas/upload_file.json +15 -0
- OpenGeodeWeb_Back-3.0.0rc12.dist-info/RECORD +0 -9
- {OpenGeodeWeb_Back-3.0.0rc12.dist-info → OpenGeodeWeb_Back-3.2.0.dist-info}/LICENSE +0 -0
- {OpenGeodeWeb_Back-3.0.0rc12.dist-info → OpenGeodeWeb_Back-3.2.0.dist-info}/WHEEL +0 -0
- {OpenGeodeWeb_Back-3.0.0rc12.dist-info → OpenGeodeWeb_Back-3.2.0.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: OpenGeodeWeb-Back
|
3
|
-
Version: 3.0
|
3
|
+
Version: 3.2.0
|
4
4
|
Summary: OpenGeodeWeb-Back is an open source framework that proposes handy python functions and wrappers for the OpenGeode ecosystem
|
5
5
|
Author-email: Geode-solutions <team-web@geode-solutions.com>
|
6
6
|
Project-URL: Homepage, https://github.com/Geode-solutions/OpenGeodeWeb-Back
|
@@ -17,6 +17,7 @@ Requires-Dist: blinker ==1.7.0
|
|
17
17
|
Requires-Dist: click ==8.1.7
|
18
18
|
Requires-Dist: colorama ==0.4.6
|
19
19
|
Requires-Dist: flask[async] ==3.0.0
|
20
|
+
Requires-Dist: flask-cors ==4.0.0
|
20
21
|
Requires-Dist: geode-background ==7.4.9
|
21
22
|
Requires-Dist: geode-common ==30.0.5
|
22
23
|
Requires-Dist: geode-conversion ==5.1.7
|
@@ -0,0 +1,16 @@
|
|
1
|
+
opengeodeweb_back/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
opengeodeweb_back/geode_functions.py,sha256=q3usbCxh-QtSRHe-WlmW8yXAdHazwmJ_o3tzvRH4gDA,10431
|
3
|
+
opengeodeweb_back/geode_objects.py,sha256=v8f98lfco4X4iDmcyF3uH_nWT7BDtp8pu-R3uRwdnxU,19048
|
4
|
+
opengeodeweb_back/inspector_functions.py,sha256=rx3LsY6ETKl1J9kKilcFRZMZrIoBZEIOebqWrcuMJsk,15903
|
5
|
+
opengeodeweb_back/routes/blueprint_routes.py,sha256=gFfPig5nz4-TZBYdJQf_xw_GvYmjKRSt6hX_SPwGqVs,5079
|
6
|
+
opengeodeweb_back/routes/schemas/allowed_files.json,sha256=BcBa90x6fcr4UiwlRjjCyTPPUD_NkQtgrHTijBTO6Z0,272
|
7
|
+
opengeodeweb_back/routes/schemas/allowed_objects.json,sha256=DmyDvMy6BwjeDwV-_UMTwY3CuUjS8IxxBQsUGYLjCmg,303
|
8
|
+
opengeodeweb_back/routes/schemas/geode_objects_and_output_extensions.json,sha256=MYZRZ1pU5Y4lSNAZpuGwBkTH3n6S5Gg8fCV1WwmyB4M,382
|
9
|
+
opengeodeweb_back/routes/schemas/geographic_coordinate_systems.json,sha256=-bOENKaoc-jezLvx8KJ0KYOXIW7HG5C1wMPiWusXnDE,306
|
10
|
+
opengeodeweb_back/routes/schemas/missing_files.json,sha256=yNcFaGbOgazgArqqEutVQMzMCrS3lbq_W6n7Oc_MHOs,319
|
11
|
+
opengeodeweb_back/routes/schemas/upload_file.json,sha256=dHB52x6oftQ7cXXIG0eQkzc9TzC5rM_hzW410Ha9neo,266
|
12
|
+
OpenGeodeWeb_Back-3.2.0.dist-info/LICENSE,sha256=d-icw4NmOEwW-hCOcEjYmvoBZW_cEqiC4VL3cxZMe6Y,1072
|
13
|
+
OpenGeodeWeb_Back-3.2.0.dist-info/METADATA,sha256=DZPp1RNkUMHAp-cn1V3zA3-ucP5zbgwCXLO6ctJAcaA,3185
|
14
|
+
OpenGeodeWeb_Back-3.2.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
15
|
+
OpenGeodeWeb_Back-3.2.0.dist-info/top_level.txt,sha256=tN1FZeLIVBrdja2-pbmhg5-tK-JILmmT9OeIBnhlUrQ,18
|
16
|
+
OpenGeodeWeb_Back-3.2.0.dist-info/RECORD,,
|
@@ -1,16 +1,15 @@
|
|
1
1
|
# Standard library imports
|
2
|
-
import base64
|
3
2
|
import os
|
4
3
|
import time
|
5
4
|
import threading
|
6
5
|
import uuid
|
6
|
+
import zipfile
|
7
7
|
|
8
8
|
# Third party imports
|
9
9
|
import flask
|
10
10
|
import opengeode_geosciences as og_gs
|
11
11
|
import opengeode as og
|
12
12
|
import pkg_resources
|
13
|
-
import werkzeug
|
14
13
|
from jsonschema import validate
|
15
14
|
from jsonschema.exceptions import ValidationError
|
16
15
|
|
@@ -311,7 +310,7 @@ def send_file(upload_folder, saved_files, new_file_name):
|
|
311
310
|
mimetype = "application/octet-binary"
|
312
311
|
else:
|
313
312
|
mimetype = "application/zip"
|
314
|
-
new_file_name =
|
313
|
+
new_file_name = os.path.splitext(new_file_name)[0] + ".zip"
|
315
314
|
with zipfile.ZipFile(os.path.join(upload_folder, new_file_name), "w") as zipObj:
|
316
315
|
for saved_file_path in saved_files:
|
317
316
|
zipObj.write(
|
@@ -0,0 +1,178 @@
|
|
1
|
+
# Standard library imports
|
2
|
+
import json
|
3
|
+
import os
|
4
|
+
|
5
|
+
# Third party imports
|
6
|
+
import flask
|
7
|
+
import flask_cors
|
8
|
+
from .. import geode_functions
|
9
|
+
import werkzeug
|
10
|
+
|
11
|
+
|
12
|
+
routes = flask.Blueprint("routes", __name__)
|
13
|
+
flask_cors.CORS(routes)
|
14
|
+
|
15
|
+
|
16
|
+
schemas = os.path.join(os.path.dirname(__file__), "schemas")
|
17
|
+
|
18
|
+
with open(
|
19
|
+
os.path.join(schemas, "allowed_files.json"),
|
20
|
+
"r",
|
21
|
+
) as file:
|
22
|
+
allowed_files_json = json.load(file)
|
23
|
+
|
24
|
+
|
25
|
+
@routes.route(
|
26
|
+
allowed_files_json["route"],
|
27
|
+
methods=allowed_files_json["methods"],
|
28
|
+
)
|
29
|
+
def allowed_files():
|
30
|
+
geode_functions.validate_request(flask.request, allowed_files_json)
|
31
|
+
extensions = geode_functions.list_input_extensions(flask.request.json["key"])
|
32
|
+
return {"status": 200, "extensions": extensions}
|
33
|
+
|
34
|
+
|
35
|
+
with open(
|
36
|
+
os.path.join(schemas, "upload_file.json"),
|
37
|
+
"r",
|
38
|
+
) as file:
|
39
|
+
upload_file_json = json.load(file)
|
40
|
+
|
41
|
+
|
42
|
+
@routes.route(
|
43
|
+
upload_file_json["route"],
|
44
|
+
methods=upload_file_json["methods"],
|
45
|
+
)
|
46
|
+
def upload_file():
|
47
|
+
if flask.request.method == "OPTIONS":
|
48
|
+
return flask.make_response({}, 200)
|
49
|
+
|
50
|
+
UPLOAD_FOLDER = flask.current_app.config["UPLOAD_FOLDER"]
|
51
|
+
if not os.path.exists(UPLOAD_FOLDER):
|
52
|
+
os.mkdir(UPLOAD_FOLDER)
|
53
|
+
file = flask.request.files["file"]
|
54
|
+
filename = werkzeug.utils.secure_filename(os.path.basename(file.filename))
|
55
|
+
file.save(os.path.join(UPLOAD_FOLDER, filename))
|
56
|
+
return flask.make_response({"message": "File uploaded"}, 201)
|
57
|
+
|
58
|
+
|
59
|
+
with open(
|
60
|
+
os.path.join(schemas, "allowed_objects.json"),
|
61
|
+
"r",
|
62
|
+
) as file:
|
63
|
+
allowed_objects_json = json.load(file)
|
64
|
+
|
65
|
+
|
66
|
+
@routes.route(
|
67
|
+
allowed_objects_json["route"],
|
68
|
+
methods=allowed_objects_json["methods"],
|
69
|
+
)
|
70
|
+
def allowed_objects():
|
71
|
+
if flask.request.method == "OPTIONS":
|
72
|
+
return flask.make_response({}, 200)
|
73
|
+
|
74
|
+
UPLOAD_FOLDER = flask.current_app.config["UPLOAD_FOLDER"]
|
75
|
+
geode_functions.validate_request(flask.request, allowed_objects_json)
|
76
|
+
file_absolute_path = os.path.join(UPLOAD_FOLDER, flask.request.json["filename"])
|
77
|
+
allowed_objects = geode_functions.list_geode_objects(
|
78
|
+
file_absolute_path, flask.request.json["key"]
|
79
|
+
)
|
80
|
+
return flask.make_response({"allowed_objects": allowed_objects}, 200)
|
81
|
+
|
82
|
+
|
83
|
+
with open(
|
84
|
+
os.path.join(schemas, "missing_files.json"),
|
85
|
+
"r",
|
86
|
+
) as file:
|
87
|
+
missing_files_json = json.load(file)
|
88
|
+
|
89
|
+
|
90
|
+
@routes.route(
|
91
|
+
missing_files_json["route"],
|
92
|
+
methods=missing_files_json["methods"],
|
93
|
+
)
|
94
|
+
def missing_files():
|
95
|
+
UPLOAD_FOLDER = flask.current_app.config["UPLOAD_FOLDER"]
|
96
|
+
geode_functions.validate_request(flask.request, missing_files_json)
|
97
|
+
|
98
|
+
missing_files = geode_functions.missing_files(
|
99
|
+
flask.request.json["input_geode_object"],
|
100
|
+
os.path.join(UPLOAD_FOLDER, flask.request.json["filename"]),
|
101
|
+
)
|
102
|
+
has_missing_files = missing_files.has_missing_files()
|
103
|
+
|
104
|
+
mandatory_files = []
|
105
|
+
for mandatory_file in missing_files.mandatory_files:
|
106
|
+
mandatory_files.append(os.path.basename(mandatory_file))
|
107
|
+
|
108
|
+
additional_files = []
|
109
|
+
for additional_file in missing_files.additional_files:
|
110
|
+
additional_files.append(os.path.basename(additional_file))
|
111
|
+
|
112
|
+
return flask.make_response(
|
113
|
+
{
|
114
|
+
"has_missing_files": has_missing_files,
|
115
|
+
"mandatory_files": mandatory_files,
|
116
|
+
"additional_files": additional_files,
|
117
|
+
},
|
118
|
+
200,
|
119
|
+
)
|
120
|
+
|
121
|
+
|
122
|
+
with open(
|
123
|
+
os.path.join(schemas, "geographic_coordinate_systems.json"),
|
124
|
+
"r",
|
125
|
+
) as file:
|
126
|
+
geographic_coordinate_systems_json = json.load(file)
|
127
|
+
|
128
|
+
|
129
|
+
@routes.route(
|
130
|
+
geographic_coordinate_systems_json["route"],
|
131
|
+
methods=geographic_coordinate_systems_json["methods"],
|
132
|
+
)
|
133
|
+
def crs_converter_geographic_coordinate_systems():
|
134
|
+
geode_functions.validate_request(flask.request, geographic_coordinate_systems_json)
|
135
|
+
infos = geode_functions.geographic_coordinate_systems(
|
136
|
+
flask.request.json["input_geode_object"]
|
137
|
+
)
|
138
|
+
crs_list = []
|
139
|
+
|
140
|
+
for info in infos:
|
141
|
+
crs = {}
|
142
|
+
crs["name"] = info.name
|
143
|
+
crs["code"] = info.code
|
144
|
+
crs["authority"] = info.authority
|
145
|
+
crs_list.append(crs)
|
146
|
+
|
147
|
+
return flask.make_response({"crs_list": crs_list}, 200)
|
148
|
+
|
149
|
+
|
150
|
+
with open(
|
151
|
+
os.path.join(schemas, "geode_objects_and_output_extensions.json"),
|
152
|
+
"r",
|
153
|
+
) as file:
|
154
|
+
geode_objects_and_output_extensions_json = json.load(file)
|
155
|
+
|
156
|
+
|
157
|
+
@routes.route(
|
158
|
+
geode_objects_and_output_extensions_json["route"],
|
159
|
+
methods=geode_objects_and_output_extensions_json["methods"],
|
160
|
+
)
|
161
|
+
def geode_objects_and_output_extensions():
|
162
|
+
UPLOAD_FOLDER = flask.current_app.config["UPLOAD_FOLDER"]
|
163
|
+
geode_functions.validate_request(
|
164
|
+
flask.request, geode_objects_and_output_extensions_json
|
165
|
+
)
|
166
|
+
data = geode_functions.load(
|
167
|
+
flask.request.json["input_geode_object"],
|
168
|
+
os.path.join(UPLOAD_FOLDER, flask.request.json["filename"]),
|
169
|
+
)
|
170
|
+
geode_objects_and_output_extensions = (
|
171
|
+
geode_functions.geode_objects_output_extensions(
|
172
|
+
flask.request.json["input_geode_object"], data
|
173
|
+
)
|
174
|
+
)
|
175
|
+
return flask.make_response(
|
176
|
+
{"geode_objects_and_output_extensions": geode_objects_and_output_extensions},
|
177
|
+
200,
|
178
|
+
)
|
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"$id": "/allowed_files",
|
3
|
+
"route": "/allowed_files",
|
4
|
+
"methods": [
|
5
|
+
"POST"
|
6
|
+
],
|
7
|
+
"type": "object",
|
8
|
+
"properties": {
|
9
|
+
"key": {
|
10
|
+
"type": [
|
11
|
+
"string",
|
12
|
+
"null"
|
13
|
+
]
|
14
|
+
}
|
15
|
+
},
|
16
|
+
"required": [
|
17
|
+
"key"
|
18
|
+
],
|
19
|
+
"additionalProperties": false
|
20
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
"$id": "/tools/allowed_objects",
|
3
|
+
"route": "/allowed_objects",
|
4
|
+
"methods": ["POST"],
|
5
|
+
"type": "object",
|
6
|
+
"properties": {
|
7
|
+
"filename": {
|
8
|
+
"type": "string"
|
9
|
+
},
|
10
|
+
"key": {
|
11
|
+
"type": ["string", "null"]
|
12
|
+
}
|
13
|
+
},
|
14
|
+
"required": ["filename", "key"],
|
15
|
+
"additionalProperties": false
|
16
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
{
|
2
|
+
"$id": "/tools/geode_objects_and_output_extensions",
|
3
|
+
"route": "/geode_objects_and_output_extensions",
|
4
|
+
"methods": [
|
5
|
+
"POST"
|
6
|
+
],
|
7
|
+
"type": "object",
|
8
|
+
"properties": {
|
9
|
+
"input_geode_object": {
|
10
|
+
"type": "string"
|
11
|
+
},
|
12
|
+
"filename": {
|
13
|
+
"type": "string"
|
14
|
+
}
|
15
|
+
},
|
16
|
+
"required": [
|
17
|
+
"input_geode_object",
|
18
|
+
"filename"
|
19
|
+
],
|
20
|
+
"additionalProperties": false
|
21
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
{
|
2
|
+
"$id": "/tools/geographic_coordinate_systems",
|
3
|
+
"route": "/geographic_coordinate_systems",
|
4
|
+
"methods": [
|
5
|
+
"POST"
|
6
|
+
],
|
7
|
+
"type": "object",
|
8
|
+
"properties": {
|
9
|
+
"input_geode_object": {
|
10
|
+
"type": "string"
|
11
|
+
}
|
12
|
+
},
|
13
|
+
"required": [
|
14
|
+
"input_geode_object"
|
15
|
+
],
|
16
|
+
"additionalProperties": false
|
17
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
"$id": "/tools/missing_files",
|
3
|
+
"route": "/missing_files",
|
4
|
+
"methods": ["POST"],
|
5
|
+
"type": "object",
|
6
|
+
"properties": {
|
7
|
+
"input_geode_object": {
|
8
|
+
"type": "string"
|
9
|
+
},
|
10
|
+
"filename": {
|
11
|
+
"type": "string"
|
12
|
+
}
|
13
|
+
},
|
14
|
+
"required": ["input_geode_object", "filename"],
|
15
|
+
"additionalProperties": false
|
16
|
+
}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
opengeodeweb_back/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
opengeodeweb_back/geode_functions.py,sha256=2BenLnXZxylZno4ptzDq-0i1JqZToxc-yQTLl27tAXI,10428
|
3
|
-
opengeodeweb_back/geode_objects.py,sha256=v8f98lfco4X4iDmcyF3uH_nWT7BDtp8pu-R3uRwdnxU,19048
|
4
|
-
opengeodeweb_back/inspector_functions.py,sha256=rx3LsY6ETKl1J9kKilcFRZMZrIoBZEIOebqWrcuMJsk,15903
|
5
|
-
OpenGeodeWeb_Back-3.0.0rc12.dist-info/LICENSE,sha256=d-icw4NmOEwW-hCOcEjYmvoBZW_cEqiC4VL3cxZMe6Y,1072
|
6
|
-
OpenGeodeWeb_Back-3.0.0rc12.dist-info/METADATA,sha256=FCD6z7w7j_1OYw9j8YwvglwoDVQ3N1NsOKhmsxl7hNA,3155
|
7
|
-
OpenGeodeWeb_Back-3.0.0rc12.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
8
|
-
OpenGeodeWeb_Back-3.0.0rc12.dist-info/top_level.txt,sha256=tN1FZeLIVBrdja2-pbmhg5-tK-JILmmT9OeIBnhlUrQ,18
|
9
|
-
OpenGeodeWeb_Back-3.0.0rc12.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|