py-soap 2020.3.1__py3-none-any.whl → 2025.5rc1__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.
- py_soap-2025.5rc1.dist-info/METADATA +8 -0
- py_soap-2025.5rc1.dist-info/RECORD +6 -0
- {py_soap-2020.3.1.dist-info → py_soap-2025.5rc1.dist-info}/WHEEL +2 -1
- py_soap-2025.5rc1.dist-info/top_level.txt +3 -0
- pysoap/envelope.py +195 -95
- py_soap-2020.3.1.dist-info/LICENSE +0 -21
- py_soap-2020.3.1.dist-info/METADATA +0 -49
- py_soap-2020.3.1.dist-info/RECORD +0 -6
@@ -0,0 +1,6 @@
|
|
1
|
+
pysoap/__init__.py,sha256=B-Lie-enh4rrQ5C88czCm4-An9zTrDDOzdt2EYH3x4w,51
|
2
|
+
pysoap/envelope.py,sha256=XdUe_Trs1nmEfXrzVw8neUH7-fE385__yiwKaozXLf8,79582
|
3
|
+
py_soap-2025.5rc1.dist-info/METADATA,sha256=s4aoCL5OHaNEPVqPSAIarLMkDkFk0o-knQ9M4NBXYq4,178
|
4
|
+
py_soap-2025.5rc1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
5
|
+
py_soap-2025.5rc1.dist-info/top_level.txt,sha256=tRfSlArpXgZxPEAriwUcVCfKRDURP323eKqfpk7iTaQ,20
|
6
|
+
py_soap-2025.5rc1.dist-info/RECORD,,
|
pysoap/envelope.py
CHANGED
@@ -2,21 +2,35 @@
|
|
2
2
|
# -*- coding: utf-8 -*-
|
3
3
|
|
4
4
|
#
|
5
|
-
# Generated Sun
|
6
|
-
# Python 3.8.
|
7
|
-
|
5
|
+
# Generated Sun Nov 21 22:54:33 2021 by generateDS.py version 2.40.5.
|
6
|
+
# Python 3.8.6 (v3.8.6:db455296be, Sep 23 2020, 13:31:39) [Clang 6.0 (clang-600.0.57)]
|
7
|
+
#
|
8
|
+
# Command line options:
|
9
|
+
# ('--no-namespace-defs', '')
|
10
|
+
# ('-o', './pysoap/envelope.py')
|
11
|
+
#
|
12
|
+
# Command line arguments:
|
13
|
+
# ./schemas/schemas.xmlsoap.org.xml
|
14
|
+
#
|
15
|
+
# Command line:
|
16
|
+
# /Users/danielkobina/Workspace/project/karrio/.venv/karrio/bin/generateDS --no-namespace-defs -o "./pysoap/envelope.py" ./schemas/schemas.xmlsoap.org.xml
|
17
|
+
#
|
18
|
+
# Current working directory (os.getcwd()):
|
19
|
+
# soap
|
20
|
+
#
|
8
21
|
|
22
|
+
import sys
|
23
|
+
try:
|
24
|
+
ModulenotfoundExp_ = ModuleNotFoundError
|
25
|
+
except NameError:
|
26
|
+
ModulenotfoundExp_ = ImportError
|
9
27
|
from six.moves import zip_longest
|
10
28
|
import os
|
11
|
-
import sys
|
12
29
|
import re as re_
|
13
30
|
import base64
|
14
31
|
import datetime as datetime_
|
15
32
|
import decimal as decimal_
|
16
|
-
|
17
|
-
from lxml import etree as etree_
|
18
|
-
except ImportError:
|
19
|
-
from xml.etree import ElementTree as etree_
|
33
|
+
from lxml import etree as etree_
|
20
34
|
|
21
35
|
|
22
36
|
Validate_simpletypes_ = True
|
@@ -79,7 +93,7 @@ def parsexmlstring_(instring, parser=None, **kwargs):
|
|
79
93
|
# Additionally, the generatedsnamespaces module can contain a python
|
80
94
|
# dictionary named GenerateDSNamespaceTypePrefixes that associates element
|
81
95
|
# types with the namespace prefixes that are to be added to the
|
82
|
-
# "xsi:type" attribute value. See the
|
96
|
+
# "xsi:type" attribute value. See the _exportAttributes method of
|
83
97
|
# any generated element type and the generation of "xsi:type" for an
|
84
98
|
# example of the use of this table.
|
85
99
|
# An example table:
|
@@ -94,11 +108,11 @@ def parsexmlstring_(instring, parser=None, **kwargs):
|
|
94
108
|
|
95
109
|
try:
|
96
110
|
from generatedsnamespaces import GenerateDSNamespaceDefs as GenerateDSNamespaceDefs_
|
97
|
-
except
|
111
|
+
except ModulenotfoundExp_ :
|
98
112
|
GenerateDSNamespaceDefs_ = {}
|
99
113
|
try:
|
100
114
|
from generatedsnamespaces import GenerateDSNamespaceTypePrefixes as GenerateDSNamespaceTypePrefixes_
|
101
|
-
except
|
115
|
+
except ModulenotfoundExp_ :
|
102
116
|
GenerateDSNamespaceTypePrefixes_ = {}
|
103
117
|
|
104
118
|
#
|
@@ -109,7 +123,7 @@ except ImportError:
|
|
109
123
|
#
|
110
124
|
try:
|
111
125
|
from generatedscollector import GdsCollector as GdsCollector_
|
112
|
-
except
|
126
|
+
except ModulenotfoundExp_ :
|
113
127
|
|
114
128
|
class GdsCollector_(object):
|
115
129
|
|
@@ -143,7 +157,7 @@ except ImportError:
|
|
143
157
|
|
144
158
|
try:
|
145
159
|
from enum import Enum
|
146
|
-
except
|
160
|
+
except ModulenotfoundExp_ :
|
147
161
|
Enum = object
|
148
162
|
|
149
163
|
#
|
@@ -155,9 +169,14 @@ except ImportError:
|
|
155
169
|
|
156
170
|
try:
|
157
171
|
from generatedssuper import GeneratedsSuper
|
158
|
-
except
|
172
|
+
except ModulenotfoundExp_ as exp:
|
173
|
+
try:
|
174
|
+
from generatedssupersuper import GeneratedsSuperSuper
|
175
|
+
except ModulenotfoundExp_ as exp:
|
176
|
+
class GeneratedsSuperSuper(object):
|
177
|
+
pass
|
159
178
|
|
160
|
-
class GeneratedsSuper(
|
179
|
+
class GeneratedsSuper(GeneratedsSuperSuper):
|
161
180
|
__hash__ = object.__hash__
|
162
181
|
tzoff_pattern = re_.compile(r'(\+|-)((0\d|1[0-3]):[0-5]\d|14:00)$')
|
163
182
|
class _FixedOffsetTZ(datetime_.tzinfo):
|
@@ -170,6 +189,30 @@ except ImportError as exp:
|
|
170
189
|
return self.__name
|
171
190
|
def dst(self, dt):
|
172
191
|
return None
|
192
|
+
def __str__(self):
|
193
|
+
settings = {
|
194
|
+
'str_pretty_print': True,
|
195
|
+
'str_indent_level': 0,
|
196
|
+
'str_namespaceprefix': '',
|
197
|
+
'str_name': None,
|
198
|
+
'str_namespacedefs': '',
|
199
|
+
}
|
200
|
+
for n in settings:
|
201
|
+
if hasattr(self, n):
|
202
|
+
setattr(settings[n], self[n])
|
203
|
+
from io import StringIO
|
204
|
+
output = StringIO()
|
205
|
+
self.export(
|
206
|
+
output,
|
207
|
+
settings['str_indent_level'],
|
208
|
+
pretty_print=settings['str_pretty_print'],
|
209
|
+
namespaceprefix_=settings['str_namespaceprefix'],
|
210
|
+
name_=settings['str_name'],
|
211
|
+
namespacedef_=settings['str_namespacedefs']
|
212
|
+
)
|
213
|
+
strval = output.getvalue()
|
214
|
+
output.close()
|
215
|
+
return strval
|
173
216
|
def gds_format_string(self, input_data, input_name=''):
|
174
217
|
return input_data
|
175
218
|
def gds_parse_string(self, input_data, node=None, input_name=''):
|
@@ -180,11 +223,11 @@ except ImportError as exp:
|
|
180
223
|
else:
|
181
224
|
return input_data
|
182
225
|
def gds_format_base64(self, input_data, input_name=''):
|
183
|
-
return base64.b64encode(input_data)
|
226
|
+
return base64.b64encode(input_data).decode('ascii')
|
184
227
|
def gds_validate_base64(self, input_data, node=None, input_name=''):
|
185
228
|
return input_data
|
186
229
|
def gds_format_integer(self, input_data, input_name=''):
|
187
|
-
return '%d' % input_data
|
230
|
+
return '%d' % int(input_data)
|
188
231
|
def gds_parse_integer(self, input_data, node=None, input_name=''):
|
189
232
|
try:
|
190
233
|
ival = int(input_data)
|
@@ -198,6 +241,8 @@ except ImportError as exp:
|
|
198
241
|
raise_parse_error(node, 'Requires integer value')
|
199
242
|
return value
|
200
243
|
def gds_format_integer_list(self, input_data, input_name=''):
|
244
|
+
if len(input_data) > 0 and not isinstance(input_data[0], BaseStrType_):
|
245
|
+
input_data = [str(s) for s in input_data]
|
201
246
|
return '%s' % ' '.join(input_data)
|
202
247
|
def gds_validate_integer_list(
|
203
248
|
self, input_data, node=None, input_name=''):
|
@@ -206,10 +251,10 @@ except ImportError as exp:
|
|
206
251
|
try:
|
207
252
|
int(value)
|
208
253
|
except (TypeError, ValueError):
|
209
|
-
raise_parse_error(node, 'Requires sequence of integer
|
254
|
+
raise_parse_error(node, 'Requires sequence of integer values')
|
210
255
|
return values
|
211
256
|
def gds_format_float(self, input_data, input_name=''):
|
212
|
-
return ('%.15f' % input_data).rstrip('0')
|
257
|
+
return ('%.15f' % float(input_data)).rstrip('0')
|
213
258
|
def gds_parse_float(self, input_data, node=None, input_name=''):
|
214
259
|
try:
|
215
260
|
fval_ = float(input_data)
|
@@ -223,6 +268,8 @@ except ImportError as exp:
|
|
223
268
|
raise_parse_error(node, 'Requires float value')
|
224
269
|
return value
|
225
270
|
def gds_format_float_list(self, input_data, input_name=''):
|
271
|
+
if len(input_data) > 0 and not isinstance(input_data[0], BaseStrType_):
|
272
|
+
input_data = [str(s) for s in input_data]
|
226
273
|
return '%s' % ' '.join(input_data)
|
227
274
|
def gds_validate_float_list(
|
228
275
|
self, input_data, node=None, input_name=''):
|
@@ -234,7 +281,12 @@ except ImportError as exp:
|
|
234
281
|
raise_parse_error(node, 'Requires sequence of float values')
|
235
282
|
return values
|
236
283
|
def gds_format_decimal(self, input_data, input_name=''):
|
237
|
-
|
284
|
+
return_value = '%s' % input_data
|
285
|
+
if '.' in return_value:
|
286
|
+
return_value = return_value.rstrip('0')
|
287
|
+
if return_value.endswith('.'):
|
288
|
+
return_value = return_value.rstrip('.')
|
289
|
+
return return_value
|
238
290
|
def gds_parse_decimal(self, input_data, node=None, input_name=''):
|
239
291
|
try:
|
240
292
|
decimal_value = decimal_.Decimal(input_data)
|
@@ -248,7 +300,9 @@ except ImportError as exp:
|
|
248
300
|
raise_parse_error(node, 'Requires decimal value')
|
249
301
|
return value
|
250
302
|
def gds_format_decimal_list(self, input_data, input_name=''):
|
251
|
-
|
303
|
+
if len(input_data) > 0 and not isinstance(input_data[0], BaseStrType_):
|
304
|
+
input_data = [str(s) for s in input_data]
|
305
|
+
return ' '.join([self.gds_format_decimal(item) for item in input_data])
|
252
306
|
def gds_validate_decimal_list(
|
253
307
|
self, input_data, node=None, input_name=''):
|
254
308
|
values = input_data.split()
|
@@ -259,7 +313,7 @@ except ImportError as exp:
|
|
259
313
|
raise_parse_error(node, 'Requires sequence of decimal values')
|
260
314
|
return values
|
261
315
|
def gds_format_double(self, input_data, input_name=''):
|
262
|
-
return '%
|
316
|
+
return '%s' % input_data
|
263
317
|
def gds_parse_double(self, input_data, node=None, input_name=''):
|
264
318
|
try:
|
265
319
|
fval_ = float(input_data)
|
@@ -273,6 +327,8 @@ except ImportError as exp:
|
|
273
327
|
raise_parse_error(node, 'Requires double or float value')
|
274
328
|
return value
|
275
329
|
def gds_format_double_list(self, input_data, input_name=''):
|
330
|
+
if len(input_data) > 0 and not isinstance(input_data[0], BaseStrType_):
|
331
|
+
input_data = [str(s) for s in input_data]
|
276
332
|
return '%s' % ' '.join(input_data)
|
277
333
|
def gds_validate_double_list(
|
278
334
|
self, input_data, node=None, input_name=''):
|
@@ -302,11 +358,14 @@ except ImportError as exp:
|
|
302
358
|
'(one of True, 1, False, 0)')
|
303
359
|
return input_data
|
304
360
|
def gds_format_boolean_list(self, input_data, input_name=''):
|
361
|
+
if len(input_data) > 0 and not isinstance(input_data[0], BaseStrType_):
|
362
|
+
input_data = [str(s) for s in input_data]
|
305
363
|
return '%s' % ' '.join(input_data)
|
306
364
|
def gds_validate_boolean_list(
|
307
365
|
self, input_data, node=None, input_name=''):
|
308
366
|
values = input_data.split()
|
309
367
|
for value in values:
|
368
|
+
value = self.gds_parse_boolean(value, node, input_name)
|
310
369
|
if value not in (True, 1, False, 0, ):
|
311
370
|
raise_parse_error(
|
312
371
|
node,
|
@@ -753,7 +812,10 @@ def find_attr_value_(attr_name, node):
|
|
753
812
|
value = attrs.get(attr_name)
|
754
813
|
elif len(attr_parts) == 2:
|
755
814
|
prefix, name = attr_parts
|
756
|
-
|
815
|
+
if prefix == 'xml':
|
816
|
+
namespace = 'http://www.w3.org/XML/1998/namespace'
|
817
|
+
else:
|
818
|
+
namespace = node.nsmap.get(prefix)
|
757
819
|
if namespace is not None:
|
758
820
|
value = attrs.get('{%s}%s' % (namespace, name, ))
|
759
821
|
return value
|
@@ -834,7 +896,7 @@ class MixedContainer:
|
|
834
896
|
self.name,
|
835
897
|
base64.b64encode(self.value),
|
836
898
|
self.name))
|
837
|
-
def to_etree(self, element):
|
899
|
+
def to_etree(self, element, mapping_=None, reverse_mapping_=None, nsmap_=None):
|
838
900
|
if self.category == MixedContainer.CategoryText:
|
839
901
|
# Prevent exporting empty content as empty lines.
|
840
902
|
if self.value.strip():
|
@@ -854,7 +916,7 @@ class MixedContainer:
|
|
854
916
|
subelement.text = self.to_etree_simple()
|
855
917
|
else: # category == MixedContainer.CategoryComplex
|
856
918
|
self.value.to_etree(element)
|
857
|
-
def to_etree_simple(self):
|
919
|
+
def to_etree_simple(self, mapping_=None, reverse_mapping_=None, nsmap_=None):
|
858
920
|
if self.content_type == MixedContainer.TypeString:
|
859
921
|
text = self.value
|
860
922
|
elif (self.content_type == MixedContainer.TypeInteger or
|
@@ -980,7 +1042,7 @@ class Envelope(GeneratedsSuper):
|
|
980
1042
|
def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value
|
981
1043
|
def get_anyAttributes_(self): return self.anyAttributes_
|
982
1044
|
def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_
|
983
|
-
def
|
1045
|
+
def _hasContent(self):
|
984
1046
|
if (
|
985
1047
|
self.Header is not None or
|
986
1048
|
self.Body is not None or
|
@@ -1004,15 +1066,15 @@ class Envelope(GeneratedsSuper):
|
|
1004
1066
|
showIndent(outfile, level, pretty_print)
|
1005
1067
|
outfile.write('<%s%s%s' % (namespaceprefix_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
|
1006
1068
|
already_processed = set()
|
1007
|
-
self.
|
1008
|
-
if self.
|
1069
|
+
self._exportAttributes(outfile, level, already_processed, namespaceprefix_, name_='Envelope')
|
1070
|
+
if self._hasContent():
|
1009
1071
|
outfile.write('>%s' % (eol_, ))
|
1010
|
-
self.
|
1072
|
+
self._exportChildren(outfile, level + 1, namespaceprefix_, namespacedef_, name_='Envelope', pretty_print=pretty_print)
|
1011
1073
|
showIndent(outfile, level, pretty_print)
|
1012
1074
|
outfile.write('</%s%s>%s' % (namespaceprefix_, name_, eol_))
|
1013
1075
|
else:
|
1014
1076
|
outfile.write('/>%s' % (eol_, ))
|
1015
|
-
def
|
1077
|
+
def _exportAttributes(self, outfile, level, already_processed, namespaceprefix_='', name_='Envelope'):
|
1016
1078
|
unique_counter = 0
|
1017
1079
|
for name, value in self.anyAttributes_.items():
|
1018
1080
|
xsinamespaceprefix = 'xsi'
|
@@ -1045,7 +1107,7 @@ class Envelope(GeneratedsSuper):
|
|
1045
1107
|
outfile.write(' %s=%s' % (
|
1046
1108
|
name, quote_attrib(value), ))
|
1047
1109
|
pass
|
1048
|
-
def
|
1110
|
+
def _exportChildren(self, outfile, level, namespaceprefix_='', namespacedef_='', name_='Envelope', fromsubclass_=False, pretty_print=True):
|
1049
1111
|
if pretty_print:
|
1050
1112
|
eol_ = '\n'
|
1051
1113
|
else:
|
@@ -1056,25 +1118,28 @@ class Envelope(GeneratedsSuper):
|
|
1056
1118
|
if self.Body is not None:
|
1057
1119
|
namespaceprefix_ = self.Body_nsprefix_ + ':' if (UseCapturedNS_ and self.Body_nsprefix_) else ''
|
1058
1120
|
self.Body.export(outfile, level, namespaceprefix_='tns:', namespacedef_='', name_='Body', pretty_print=pretty_print)
|
1059
|
-
|
1060
|
-
obj_
|
1121
|
+
if not fromsubclass_:
|
1122
|
+
for obj_ in self.anytypeobjs_:
|
1123
|
+
showIndent(outfile, level, pretty_print)
|
1124
|
+
outfile.write(obj_)
|
1125
|
+
outfile.write('\n')
|
1061
1126
|
def build(self, node, gds_collector_=None):
|
1062
1127
|
self.gds_collector_ = gds_collector_
|
1063
1128
|
if SaveElementTreeNode:
|
1064
1129
|
self.gds_elementtree_node_ = node
|
1065
1130
|
already_processed = set()
|
1066
1131
|
self.ns_prefix_ = node.prefix
|
1067
|
-
self.
|
1132
|
+
self._buildAttributes(node, node.attrib, already_processed)
|
1068
1133
|
for child in node:
|
1069
1134
|
nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
|
1070
|
-
self.
|
1135
|
+
self._buildChildren(child, node, nodeName_, gds_collector_=gds_collector_)
|
1071
1136
|
return self
|
1072
|
-
def
|
1137
|
+
def _buildAttributes(self, node, attrs, already_processed):
|
1073
1138
|
self.anyAttributes_ = {}
|
1074
1139
|
for name, value in attrs.items():
|
1075
1140
|
if name not in already_processed:
|
1076
1141
|
self.anyAttributes_[name] = value
|
1077
|
-
def
|
1142
|
+
def _buildChildren(self, child_, node, nodeName_, fromsubclass_=False, gds_collector_=None):
|
1078
1143
|
if nodeName_ == 'Header':
|
1079
1144
|
obj_ = Header.factory(parent_object_=self)
|
1080
1145
|
obj_.build(child_, gds_collector_=gds_collector_)
|
@@ -1087,7 +1152,7 @@ class Envelope(GeneratedsSuper):
|
|
1087
1152
|
obj_.original_tagname_ = 'Body'
|
1088
1153
|
else:
|
1089
1154
|
content_ = self.gds_build_any(child_, 'Envelope')
|
1090
|
-
self.
|
1155
|
+
self.anytypeobjs_.append(content_)
|
1091
1156
|
# end class Envelope
|
1092
1157
|
|
1093
1158
|
|
@@ -1127,7 +1192,7 @@ class Header(GeneratedsSuper):
|
|
1127
1192
|
def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value
|
1128
1193
|
def get_anyAttributes_(self): return self.anyAttributes_
|
1129
1194
|
def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_
|
1130
|
-
def
|
1195
|
+
def _hasContent(self):
|
1131
1196
|
if (
|
1132
1197
|
self.anytypeobjs_
|
1133
1198
|
):
|
@@ -1149,15 +1214,15 @@ class Header(GeneratedsSuper):
|
|
1149
1214
|
showIndent(outfile, level, pretty_print)
|
1150
1215
|
outfile.write('<%s%s%s' % (namespaceprefix_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
|
1151
1216
|
already_processed = set()
|
1152
|
-
self.
|
1153
|
-
if self.
|
1217
|
+
self._exportAttributes(outfile, level, already_processed, namespaceprefix_, name_='Header')
|
1218
|
+
if self._hasContent():
|
1154
1219
|
outfile.write('>%s' % (eol_, ))
|
1155
|
-
self.
|
1220
|
+
self._exportChildren(outfile, level + 1, namespaceprefix_, namespacedef_, name_='Header', pretty_print=pretty_print)
|
1156
1221
|
showIndent(outfile, level, pretty_print)
|
1157
1222
|
outfile.write('</%s%s>%s' % (namespaceprefix_, name_, eol_))
|
1158
1223
|
else:
|
1159
1224
|
outfile.write('/>%s' % (eol_, ))
|
1160
|
-
def
|
1225
|
+
def _exportAttributes(self, outfile, level, already_processed, namespaceprefix_='', name_='Header'):
|
1161
1226
|
unique_counter = 0
|
1162
1227
|
for name, value in self.anyAttributes_.items():
|
1163
1228
|
xsinamespaceprefix = 'xsi'
|
@@ -1190,38 +1255,39 @@ class Header(GeneratedsSuper):
|
|
1190
1255
|
outfile.write(' %s=%s' % (
|
1191
1256
|
name, quote_attrib(value), ))
|
1192
1257
|
pass
|
1193
|
-
def
|
1258
|
+
def _exportChildren(self, outfile, level, namespaceprefix_='', namespacedef_='', name_='Header', fromsubclass_=False, pretty_print=True):
|
1194
1259
|
if pretty_print:
|
1195
1260
|
eol_ = '\n'
|
1196
1261
|
else:
|
1197
1262
|
eol_ = ''
|
1198
|
-
|
1199
|
-
obj_
|
1263
|
+
if not fromsubclass_:
|
1264
|
+
for obj_ in self.anytypeobjs_:
|
1265
|
+
showIndent(outfile, level, pretty_print)
|
1266
|
+
outfile.write(obj_)
|
1267
|
+
outfile.write('\n')
|
1200
1268
|
def build(self, node, gds_collector_=None):
|
1201
1269
|
self.gds_collector_ = gds_collector_
|
1202
1270
|
if SaveElementTreeNode:
|
1203
1271
|
self.gds_elementtree_node_ = node
|
1204
1272
|
already_processed = set()
|
1205
1273
|
self.ns_prefix_ = node.prefix
|
1206
|
-
self.
|
1274
|
+
self._buildAttributes(node, node.attrib, already_processed)
|
1207
1275
|
for child in node:
|
1208
1276
|
nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
|
1209
|
-
self.
|
1277
|
+
self._buildChildren(child, node, nodeName_, gds_collector_=gds_collector_)
|
1210
1278
|
return self
|
1211
|
-
def
|
1279
|
+
def _buildAttributes(self, node, attrs, already_processed):
|
1212
1280
|
self.anyAttributes_ = {}
|
1213
1281
|
for name, value in attrs.items():
|
1214
1282
|
if name not in already_processed:
|
1215
1283
|
self.anyAttributes_[name] = value
|
1216
|
-
def
|
1284
|
+
def _buildChildren(self, child_, node, nodeName_, fromsubclass_=False, gds_collector_=None):
|
1217
1285
|
content_ = self.gds_build_any(child_, 'Header')
|
1218
|
-
self.
|
1286
|
+
self.anytypeobjs_.append(content_)
|
1219
1287
|
# end class Header
|
1220
1288
|
|
1221
1289
|
|
1222
1290
|
class Body(GeneratedsSuper):
|
1223
|
-
"""Prose in the spec does not specify that attributes are allowed on the
|
1224
|
-
Body element"""
|
1225
1291
|
__hash__ = GeneratedsSuper.__hash__
|
1226
1292
|
subclass = None
|
1227
1293
|
superclass = None
|
@@ -1257,7 +1323,7 @@ class Body(GeneratedsSuper):
|
|
1257
1323
|
def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value
|
1258
1324
|
def get_anyAttributes_(self): return self.anyAttributes_
|
1259
1325
|
def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_
|
1260
|
-
def
|
1326
|
+
def _hasContent(self):
|
1261
1327
|
if (
|
1262
1328
|
self.anytypeobjs_
|
1263
1329
|
):
|
@@ -1279,15 +1345,15 @@ class Body(GeneratedsSuper):
|
|
1279
1345
|
showIndent(outfile, level, pretty_print)
|
1280
1346
|
outfile.write('<%s%s%s' % (namespaceprefix_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
|
1281
1347
|
already_processed = set()
|
1282
|
-
self.
|
1283
|
-
if self.
|
1348
|
+
self._exportAttributes(outfile, level, already_processed, namespaceprefix_, name_='Body')
|
1349
|
+
if self._hasContent():
|
1284
1350
|
outfile.write('>%s' % (eol_, ))
|
1285
|
-
self.
|
1351
|
+
self._exportChildren(outfile, level + 1, namespaceprefix_, namespacedef_, name_='Body', pretty_print=pretty_print)
|
1286
1352
|
showIndent(outfile, level, pretty_print)
|
1287
1353
|
outfile.write('</%s%s>%s' % (namespaceprefix_, name_, eol_))
|
1288
1354
|
else:
|
1289
1355
|
outfile.write('/>%s' % (eol_, ))
|
1290
|
-
def
|
1356
|
+
def _exportAttributes(self, outfile, level, already_processed, namespaceprefix_='', name_='Body'):
|
1291
1357
|
unique_counter = 0
|
1292
1358
|
for name, value in self.anyAttributes_.items():
|
1293
1359
|
xsinamespaceprefix = 'xsi'
|
@@ -1320,37 +1386,39 @@ class Body(GeneratedsSuper):
|
|
1320
1386
|
outfile.write(' %s=%s' % (
|
1321
1387
|
name, quote_attrib(value), ))
|
1322
1388
|
pass
|
1323
|
-
def
|
1389
|
+
def _exportChildren(self, outfile, level, namespaceprefix_='', namespacedef_='', name_='Body', fromsubclass_=False, pretty_print=True):
|
1324
1390
|
if pretty_print:
|
1325
1391
|
eol_ = '\n'
|
1326
1392
|
else:
|
1327
1393
|
eol_ = ''
|
1328
|
-
|
1329
|
-
obj_
|
1394
|
+
if not fromsubclass_:
|
1395
|
+
for obj_ in self.anytypeobjs_:
|
1396
|
+
showIndent(outfile, level, pretty_print)
|
1397
|
+
outfile.write(obj_)
|
1398
|
+
outfile.write('\n')
|
1330
1399
|
def build(self, node, gds_collector_=None):
|
1331
1400
|
self.gds_collector_ = gds_collector_
|
1332
1401
|
if SaveElementTreeNode:
|
1333
1402
|
self.gds_elementtree_node_ = node
|
1334
1403
|
already_processed = set()
|
1335
1404
|
self.ns_prefix_ = node.prefix
|
1336
|
-
self.
|
1405
|
+
self._buildAttributes(node, node.attrib, already_processed)
|
1337
1406
|
for child in node:
|
1338
1407
|
nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
|
1339
|
-
self.
|
1408
|
+
self._buildChildren(child, node, nodeName_, gds_collector_=gds_collector_)
|
1340
1409
|
return self
|
1341
|
-
def
|
1410
|
+
def _buildAttributes(self, node, attrs, already_processed):
|
1342
1411
|
self.anyAttributes_ = {}
|
1343
1412
|
for name, value in attrs.items():
|
1344
1413
|
if name not in already_processed:
|
1345
1414
|
self.anyAttributes_[name] = value
|
1346
|
-
def
|
1415
|
+
def _buildChildren(self, child_, node, nodeName_, fromsubclass_=False, gds_collector_=None):
|
1347
1416
|
content_ = self.gds_build_any(child_, 'Body')
|
1348
|
-
self.
|
1417
|
+
self.anytypeobjs_.append(content_)
|
1349
1418
|
# end class Body
|
1350
1419
|
|
1351
1420
|
|
1352
1421
|
class Fault(GeneratedsSuper):
|
1353
|
-
"""Fault reporting structure"""
|
1354
1422
|
__hash__ = GeneratedsSuper.__hash__
|
1355
1423
|
subclass = None
|
1356
1424
|
superclass = None
|
@@ -1399,7 +1467,7 @@ class Fault(GeneratedsSuper):
|
|
1399
1467
|
return self.detail
|
1400
1468
|
def set_detail(self, detail):
|
1401
1469
|
self.detail = detail
|
1402
|
-
def
|
1470
|
+
def _hasContent(self):
|
1403
1471
|
if (
|
1404
1472
|
self.faultcode is not None or
|
1405
1473
|
self.faultstring is not None or
|
@@ -1424,17 +1492,17 @@ class Fault(GeneratedsSuper):
|
|
1424
1492
|
showIndent(outfile, level, pretty_print)
|
1425
1493
|
outfile.write('<%s%s%s' % (namespaceprefix_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
|
1426
1494
|
already_processed = set()
|
1427
|
-
self.
|
1428
|
-
if self.
|
1495
|
+
self._exportAttributes(outfile, level, already_processed, namespaceprefix_, name_='Fault')
|
1496
|
+
if self._hasContent():
|
1429
1497
|
outfile.write('>%s' % (eol_, ))
|
1430
|
-
self.
|
1498
|
+
self._exportChildren(outfile, level + 1, namespaceprefix_, namespacedef_, name_='Fault', pretty_print=pretty_print)
|
1431
1499
|
showIndent(outfile, level, pretty_print)
|
1432
1500
|
outfile.write('</%s%s>%s' % (namespaceprefix_, name_, eol_))
|
1433
1501
|
else:
|
1434
1502
|
outfile.write('/>%s' % (eol_, ))
|
1435
|
-
def
|
1503
|
+
def _exportAttributes(self, outfile, level, already_processed, namespaceprefix_='', name_='Fault'):
|
1436
1504
|
pass
|
1437
|
-
def
|
1505
|
+
def _exportChildren(self, outfile, level, namespaceprefix_='', namespacedef_='', name_='Fault', fromsubclass_=False, pretty_print=True):
|
1438
1506
|
if pretty_print:
|
1439
1507
|
eol_ = '\n'
|
1440
1508
|
else:
|
@@ -1460,14 +1528,14 @@ class Fault(GeneratedsSuper):
|
|
1460
1528
|
self.gds_elementtree_node_ = node
|
1461
1529
|
already_processed = set()
|
1462
1530
|
self.ns_prefix_ = node.prefix
|
1463
|
-
self.
|
1531
|
+
self._buildAttributes(node, node.attrib, already_processed)
|
1464
1532
|
for child in node:
|
1465
1533
|
nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
|
1466
|
-
self.
|
1534
|
+
self._buildChildren(child, node, nodeName_, gds_collector_=gds_collector_)
|
1467
1535
|
return self
|
1468
|
-
def
|
1536
|
+
def _buildAttributes(self, node, attrs, already_processed):
|
1469
1537
|
pass
|
1470
|
-
def
|
1538
|
+
def _buildChildren(self, child_, node, nodeName_, fromsubclass_=False, gds_collector_=None):
|
1471
1539
|
if nodeName_ == 'faultcode':
|
1472
1540
|
value_ = child_.text
|
1473
1541
|
value_ = self.gds_parse_string(value_, node, 'faultcode')
|
@@ -1530,7 +1598,7 @@ class detail(GeneratedsSuper):
|
|
1530
1598
|
def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value
|
1531
1599
|
def get_anyAttributes_(self): return self.anyAttributes_
|
1532
1600
|
def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_
|
1533
|
-
def
|
1601
|
+
def _hasContent(self):
|
1534
1602
|
if (
|
1535
1603
|
self.anytypeobjs_
|
1536
1604
|
):
|
@@ -1552,15 +1620,15 @@ class detail(GeneratedsSuper):
|
|
1552
1620
|
showIndent(outfile, level, pretty_print)
|
1553
1621
|
outfile.write('<%s%s%s' % (namespaceprefix_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
|
1554
1622
|
already_processed = set()
|
1555
|
-
self.
|
1556
|
-
if self.
|
1623
|
+
self._exportAttributes(outfile, level, already_processed, namespaceprefix_, name_='detail')
|
1624
|
+
if self._hasContent():
|
1557
1625
|
outfile.write('>%s' % (eol_, ))
|
1558
|
-
self.
|
1626
|
+
self._exportChildren(outfile, level + 1, namespaceprefix_, namespacedef_, name_='detail', pretty_print=pretty_print)
|
1559
1627
|
showIndent(outfile, level, pretty_print)
|
1560
1628
|
outfile.write('</%s%s>%s' % (namespaceprefix_, name_, eol_))
|
1561
1629
|
else:
|
1562
1630
|
outfile.write('/>%s' % (eol_, ))
|
1563
|
-
def
|
1631
|
+
def _exportAttributes(self, outfile, level, already_processed, namespaceprefix_='', name_='detail'):
|
1564
1632
|
unique_counter = 0
|
1565
1633
|
for name, value in self.anyAttributes_.items():
|
1566
1634
|
xsinamespaceprefix = 'xsi'
|
@@ -1593,32 +1661,35 @@ class detail(GeneratedsSuper):
|
|
1593
1661
|
outfile.write(' %s=%s' % (
|
1594
1662
|
name, quote_attrib(value), ))
|
1595
1663
|
pass
|
1596
|
-
def
|
1664
|
+
def _exportChildren(self, outfile, level, namespaceprefix_='', namespacedef_='', name_='detail', fromsubclass_=False, pretty_print=True):
|
1597
1665
|
if pretty_print:
|
1598
1666
|
eol_ = '\n'
|
1599
1667
|
else:
|
1600
1668
|
eol_ = ''
|
1601
|
-
|
1602
|
-
obj_
|
1669
|
+
if not fromsubclass_:
|
1670
|
+
for obj_ in self.anytypeobjs_:
|
1671
|
+
showIndent(outfile, level, pretty_print)
|
1672
|
+
outfile.write(obj_)
|
1673
|
+
outfile.write('\n')
|
1603
1674
|
def build(self, node, gds_collector_=None):
|
1604
1675
|
self.gds_collector_ = gds_collector_
|
1605
1676
|
if SaveElementTreeNode:
|
1606
1677
|
self.gds_elementtree_node_ = node
|
1607
1678
|
already_processed = set()
|
1608
1679
|
self.ns_prefix_ = node.prefix
|
1609
|
-
self.
|
1680
|
+
self._buildAttributes(node, node.attrib, already_processed)
|
1610
1681
|
for child in node:
|
1611
1682
|
nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
|
1612
|
-
self.
|
1683
|
+
self._buildChildren(child, node, nodeName_, gds_collector_=gds_collector_)
|
1613
1684
|
return self
|
1614
|
-
def
|
1685
|
+
def _buildAttributes(self, node, attrs, already_processed):
|
1615
1686
|
self.anyAttributes_ = {}
|
1616
1687
|
for name, value in attrs.items():
|
1617
1688
|
if name not in already_processed:
|
1618
1689
|
self.anyAttributes_[name] = value
|
1619
|
-
def
|
1690
|
+
def _buildChildren(self, child_, node, nodeName_, fromsubclass_=False, gds_collector_=None):
|
1620
1691
|
content_ = self.gds_build_any(child_, 'detail')
|
1621
|
-
self.
|
1692
|
+
self.anytypeobjs_.append(content_)
|
1622
1693
|
# end class detail
|
1623
1694
|
|
1624
1695
|
|
@@ -1697,7 +1768,8 @@ def parse(inFileName, silence=False, print_warnings=True):
|
|
1697
1768
|
return rootObj
|
1698
1769
|
|
1699
1770
|
|
1700
|
-
def parseEtree(inFileName, silence=False, print_warnings=True
|
1771
|
+
def parseEtree(inFileName, silence=False, print_warnings=True,
|
1772
|
+
mapping=None, reverse_mapping=None, nsmap=None):
|
1701
1773
|
parser = None
|
1702
1774
|
doc = parsexml_(inFileName, parser)
|
1703
1775
|
gds_collector = GdsCollector_()
|
@@ -1708,10 +1780,15 @@ def parseEtree(inFileName, silence=False, print_warnings=True):
|
|
1708
1780
|
rootClass = Envelope
|
1709
1781
|
rootObj = rootClass.factory()
|
1710
1782
|
rootObj.build(rootNode, gds_collector_=gds_collector)
|
1783
|
+
if mapping is None:
|
1784
|
+
mapping = {}
|
1785
|
+
if reverse_mapping is None:
|
1786
|
+
reverse_mapping = {}
|
1787
|
+
rootElement = rootObj.to_etree(
|
1788
|
+
None, name_=rootTag, mapping_=mapping,
|
1789
|
+
reverse_mapping_=reverse_mapping, nsmap_=nsmap)
|
1790
|
+
reverse_node_mapping = rootObj.gds_reverse_node_mapping(mapping)
|
1711
1791
|
# Enable Python to collect the space used by the DOM.
|
1712
|
-
mapping = {}
|
1713
|
-
rootElement = rootObj.to_etree(None, name_=rootTag, mapping_=mapping)
|
1714
|
-
reverse_mapping = rootObj.gds_reverse_node_mapping(mapping)
|
1715
1792
|
if not SaveElementTreeNode:
|
1716
1793
|
doc = None
|
1717
1794
|
rootNode = None
|
@@ -1728,7 +1805,7 @@ def parseEtree(inFileName, silence=False, print_warnings=True):
|
|
1728
1805
|
len(gds_collector.get_messages()), ))
|
1729
1806
|
gds_collector.write_messages(sys.stderr)
|
1730
1807
|
sys.stderr.write(separator)
|
1731
|
-
return rootObj, rootElement, mapping,
|
1808
|
+
return rootObj, rootElement, mapping, reverse_node_mapping
|
1732
1809
|
|
1733
1810
|
|
1734
1811
|
def parseString(inString, silence=False, print_warnings=True):
|
@@ -1812,6 +1889,29 @@ if __name__ == '__main__':
|
|
1812
1889
|
RenameMappings_ = {
|
1813
1890
|
}
|
1814
1891
|
|
1892
|
+
#
|
1893
|
+
# Mapping of namespaces to types defined in them
|
1894
|
+
# and the file in which each is defined.
|
1895
|
+
# simpleTypes are marked "ST" and complexTypes "CT".
|
1896
|
+
NamespaceToDefMappings_ = {'http://schemas.xmlsoap.org/soap/envelope/': [('encodingStyle',
|
1897
|
+
'./schemas/schemas.xmlsoap.org.xml',
|
1898
|
+
'ST'),
|
1899
|
+
('Envelope',
|
1900
|
+
'./schemas/schemas.xmlsoap.org.xml',
|
1901
|
+
'CT'),
|
1902
|
+
('Header',
|
1903
|
+
'./schemas/schemas.xmlsoap.org.xml',
|
1904
|
+
'CT'),
|
1905
|
+
('Body',
|
1906
|
+
'./schemas/schemas.xmlsoap.org.xml',
|
1907
|
+
'CT'),
|
1908
|
+
('Fault',
|
1909
|
+
'./schemas/schemas.xmlsoap.org.xml',
|
1910
|
+
'CT'),
|
1911
|
+
('detail',
|
1912
|
+
'./schemas/schemas.xmlsoap.org.xml',
|
1913
|
+
'CT')]}
|
1914
|
+
|
1815
1915
|
__all__ = [
|
1816
1916
|
"Body",
|
1817
1917
|
"Envelope",
|
@@ -1,21 +0,0 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2018 OpenShip
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
@@ -1,49 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: py-soap
|
3
|
-
Version: 2020.3.1
|
4
|
-
Summary: SOAP Schemas Python Data Types library
|
5
|
-
Home-page: https://github.com/PurplShip/py-soap
|
6
|
-
License: MIT
|
7
|
-
Author: Dan Kobina
|
8
|
-
Author-email: danielkobina@gmail.com
|
9
|
-
Requires-Python: >=3.6,<4.0
|
10
|
-
Classifier: Intended Audience :: Developers
|
11
|
-
Classifier: License :: OSI Approved :: MIT License
|
12
|
-
Classifier: Operating System :: OS Independent
|
13
|
-
Classifier: Programming Language :: Python :: 3
|
14
|
-
Classifier: Programming Language :: Python :: 3.6
|
15
|
-
Classifier: Programming Language :: Python :: 3.7
|
16
|
-
Classifier: Programming Language :: Python :: 3.8
|
17
|
-
Classifier: Programming Language :: Python :: 3.9
|
18
|
-
Requires-Dist: lxml (>=4.6.2,<5.0.0)
|
19
|
-
Requires-Dist: six (>=1.15.0,<2.0.0)
|
20
|
-
Project-URL: Repository, https://github.com/PurplShip/py-soap
|
21
|
-
Description-Content-Type: text/markdown
|
22
|
-
|
23
|
-
# python-soap
|
24
|
-
|
25
|
-
SOAP Python Data Structure generated from [SOAP Envelope](http://schemas.xmlsoap.org/soap/envelope/) .xml file with [generateDS](http://www.davekuhlman.org/generateDS.html)
|
26
|
-
|
27
|
-
## Installation
|
28
|
-
|
29
|
-
```bash
|
30
|
-
pip install -f https://git.io/purplship py-soap
|
31
|
-
```
|
32
|
-
|
33
|
-
|
34
|
-
```python
|
35
|
-
from pysoap.envelope import Envelope, Header, Body
|
36
|
-
```
|
37
|
-
|
38
|
-
*This package is used by the [Purplship Multi-carrier Shipping SDK](https://github.com/PurplShip/purplship)*
|
39
|
-
|
40
|
-
## License
|
41
|
-
|
42
|
-
This project is licensed under the terms of the `MIT` license.
|
43
|
-
Please see [LICENSE.md](/LICENSE) for licensing details.
|
44
|
-
|
45
|
-
|
46
|
-
## Authors
|
47
|
-
|
48
|
-
- **Daniel K.** | [@DanHK91](https://twitter.com/DanHK91) | [danielk.xyz](https://danielk.xyz/)
|
49
|
-
- **Purplship Team** | hello@purplship.com | [purplship.com](https://purplship.com)
|
@@ -1,6 +0,0 @@
|
|
1
|
-
pysoap/__init__.py,sha256=B-Lie-enh4rrQ5C88czCm4-An9zTrDDOzdt2EYH3x4w,51
|
2
|
-
pysoap/envelope.py,sha256=M3RxWUB4sKF5V5dnJaqgj50T08CAJ5NlnIZ-iN51oOU,74954
|
3
|
-
py_soap-2020.3.1.dist-info/LICENSE,sha256=vyxA8U4UBlnxE-pWX8o0UKS9nBq-tnw3i_IXZxzvePM,1065
|
4
|
-
py_soap-2020.3.1.dist-info/WHEEL,sha256=SrtnPGVTMeYWttls9xnWA01eUhCZ3ufFdJUYb1J3r-U,83
|
5
|
-
py_soap-2020.3.1.dist-info/METADATA,sha256=El0cqo4mBEnBfoIjTgfyquLes4AgB8Z8jlc8zj6jWr8,1584
|
6
|
-
py_soap-2020.3.1.dist-info/RECORD,,
|