WARNING
tornado-fastrpc is deprecated, for XML-RPC use https://github.com/seifert/async-rpc instead of this library. async-rpc is based on asyncio, so it is not only for Tornado, but for asyncio in generral. Do you need FastRPC? Create an issue, I have library for FastRPC too, but it has not been published yet. However, I thint, it never mind, probably nobody outsite Seznam.cz use FastRPC :-).
tornado-fastrpc
Non-blocking XML-RPC and FastRPC (see https://github.com/seznam/fastrpc) client for Python’s Tornado. If FastRPC is not available, only XML-RPC protocol will be supported. Python 2.7 and Python 3.4 (or higher) are supported.
Instalation
Requirements:
pycurl
Tornado 3.2 or higher
Optional requirements:
fastrpc (libfastrpc + fastrpc Python’s module)
Instalation and tests:
python setup.py install python setup.py test
Build Debian Jessie package (requires dpkg-buildpackage + lintian and dependencies in Build-Depends option in debian/control file. Before building package, checkout debian-* branch.
python setup.py bdist_deb
Ussage
proxy = ServerProxy('http://example.com/RPC2:8000',
connect_timeout=5.0,
timeout=5.0,
use_binary=True)
class BazHandler(tornado.web.RequestHandler):
@tornado.gen.coroutine
def get(self):
try:
res = yield proxy.getData(123)
except Exception as e:
self.write('Error: {}'.format(e))
else:
self.write('Data: {}'.format(res.value))
class BarHandler(tornado.web.RequestHandler):
@tornado.gen.coroutine
def get(self):
res = yield proxy.getData(123, quiet=True)
if res.success:
self.write('Data: {}'.format(res.value))
else:
self.write('Error: {}'.format(res.exception))
Documentation
ServerProxy class
class tornado_fastrpc.client.ServerProxy(uri, connect_timeout=5.0, timeout=5.0, use_binary=False, user_agent=None, keep_alive=False, use_http10=True, http_proxy=None, max_clients=10)
Async FastRPC client for Tornado, tt uses pycurl backend. Manages communication with a remote RPC server.
- url <string>
URL address
- connect_timeout <float>
Timeout for initial connection in seconds
- request_timeout <float>
Timeout for entire request in seconds
- use_binary <bool>
Force binary protocol
- user_agent <string>
User-Agent string
- keep_alive <bool>
Allow keep-alive connection
- use_http10 <bool>
Force HTTP/1.0 protocol instead of HTTP/1.1
- http_proxy <string>
HTTP proxy, eg. http://user:pass@example.com:80
- max_clients <int>
Size of the Curl’s connection pool
Result object
class tornado_fastrpc.client.Result(success, value, exception)
Return type for FastRPC call. Contains attributes:
- success <bool>
True if operation succeeded, else False
- value
contains returning value if operation succeeded, else None
- exception <bool>
contains instance of the exception if operation failed, else None
Fault object
class tornado_fastrpc.client.Fault(faultCode, faultString)
Exception, indicates an XML-RPC error.
- faultCode <string>
Error code
- faultString <string>
Error message
License
3-clause BSD
Release files for tornado-fastrpc 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tornado-fastrpc-1.0.1.tar.gz | 7.0 kB | Details |
Release files / tornado-fastrpc-1.0.1.tar.gz
| Download URL | tornado-fastrpc-1.0.1.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
72b1c3a41ebc87630f15f09c883f18c3e44a5bafc3b61ee0f4f6705e33207d85
|
|
BLAKE2b-256 checksum How to use checksums |
fb027f013b18fad31f979c78893144a554729f8c03e92c8d7e6e06b3d1f9356f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3
|