Description
WSRecorder tool, which provides proxy for your webservices. Proxy allows recording and serving webservices’ samples. Proxy has form of function decorator. Samples are XSLT templates, which transform request to expected reply. XSLT template is created as decision tree, where in each node is performed test against configured xpath, paths in tree depends of value of xpath for each request.
Usage
Example:
params = {
'request_msg_name': '//request/*',
'reply_envelope_body': '//reply/*',
'messages': {
'msg1': [
'//msg1/param1/text()',
'//msg1/param2/text()'
],
},
'output_dir': '/tmp/tmpdir/,
}
recorder = WSRecorder(mode=WSRecorder.Mode.RECORD, **params)
cls.record_service = staticmethod(recorder.decorator(web_service_mockup))
Documentation
Object of this class provide proxy for werbservices. To use proxy you need to create object of this class before.
WSRecorder.__init__(self, request_msg_name, reply_envelope_body, output_dir, mode=None, output_filename=’{0}.output’, messages={}):
- request_msg_name:
xpath that indicates name of request message. Message name is afterward used to configure specific handler for each message and to save replies of different messages to different files.
- reply_envelope_body:
xpath that indicates body of reply message. Reply body is that part of reply, which is meaningful and changes for every requests. Everything “above” the reply body is reused in every reply message.
- output_dir:
directory where recorded samples are stored and which is read to serve already recorded samples.
- mode:
controls behaviour of WSRecorder. Default value: WSRecorder.Mode.TRANSPARENT. Available values: WSRecorder.Mode.RECORD - records samples according to configuration to output directory. WSRecorder.Mode.OVERRIDE - records sample according to configuration, if finds that such message was already recorded, overrides it. WSRecorder.Mode.SERVE - serves recorded samples, doesn’t hit the webservices. WSRecorder.Mode.TRANSPARENT - serves recorded samples, just hit the webservices.
- output_filename:
pattern for saved files. Default value {0}.output. To format function message name is passed.
- messages:
dictionary of configured messages. Keys in dictionary are messages names, values are list of xpaths, which are sequential checked against request message.
WSRecorder.decorator(self, fn, mode=None):
Proxy for your webservice. It requires that decorated function as first argument takes request message and return jest reply of message. Request and replies of messages must be Python string or lxml.etree._Element.
Example usage:
@obj.decorator
def webservice1(request):
return {}
Metadata
Release files for ws-recorder 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ws-recorder-0.9.0.tar.gz | 8.2 kB | Without provenance | Details |
Release files / ws-recorder-0.9.0.tar.gz
| Download URL | ws-recorder-0.9.0.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0a7573c4a6a9f696eaaa3575e044b0620053c1668d3636dff92d8b4e84db76a5
|
|
BLAKE2b-256 checksum How to use checksums |
4ca932b491bf0a703ef278a1fef495f9554698523c05dc893fb8f48d470d6999
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for ws-recorder 0.9.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.