]> git.evergreen-ils.org Git - OpenSRF.git/blob - examples/simple_text.py.in
LP#1180849: test case - ignoring subrequest responses after respond_complete()
[OpenSRF.git] / examples / simple_text.py.in
1 #!/usr/bin/env python
2 import osrf.system
3 import osrf.ses
4
5 # XXX: Replace with command line arguments
6 file = '@CONF_DIR@/conf/opensrf_core.xml'
7 method = 'opensrf.simple-text.reverse'
8 text = 'raboof'
9
10 # Pull connection settings from <config><opensrf> section of opensrf_core.xml
11 osrf.system.System.connect(config_file=file, config_context='config.opensrf')
12
13 # Set up a connection to the opensrf.math service
14 session = osrf.ses.ClientSession('opensrf.simple-text')
15
16 # Call one of the methods defined by the opensrf.math service
17 request = session.request(method, text)
18
19 # Retrieve the response from the method
20 response = request.recv(timeout=2)
21
22 print(response.content())
23
24 # Cleanup request and connection resources
25 request.cleanup()
26 session.cleanup()