Giter VIP home page Giter VIP logo

txjsonrpc's Introduction

Introduction

txJSON-RPC allows you to create async Python JSON-RPC servers and clients either over HTTP or directly on TCP with the Netstring protocol. txJSON-RPC is written in Twisted.

Features

  • Asynchronous JSON-RPC server and client code.
  • Support for HTTP and TCP (Netstring) JSON-RPC.
  • A jsonrpclib similar to the one for XLM-RPC offered by the Python standard library.

txjsonrpc's People

Contributors

abbbe avatar aborilov avatar eminarcissus avatar hefee avatar iffy avatar manishtomar avatar nside avatar oubiwann avatar rockstar avatar smurfix avatar tomprince avatar wuan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

txjsonrpc's Issues

Please provide a way for cross-origin requests to web.jsonrps

According to http://www.w3.org/TR/cors/
this requires adding some Acess-Control headers
in both POST and OPTIONS requests.

My workaround:

--- a/txjsonrpc/web/jsonrpc.py
+++ b/txjsonrpc/web/jsonrpc.py
@@ -85,10 +85,19 @@ class JSONRPC(resource.Resource, BaseSubhandler):
     def __init__(self):
         resource.Resource.__init__(self)
         BaseSubhandler.__init__(self)
+    
+    # additional headers to add
+    aux_headers = []
+    def add_aux_headers(self, request):
+        for h,v in self.aux_headers:
+            request.setHeader(h,v)

     def render(self, request):
+        self.add_aux_headers(request)
+        if request.method == 'OPTIONS':
+            return ""
         request.content.seek(0, 0)
-        # Unmarshal the JSON-RPC data.
+        # Unmarshal the JSON-RPC data.        
         content = request.content.read()
         if not content and request.method=='GET' and request.args.has_key('request'):
             content=request.args['request'][0]

set request and header in args

Hi,
I want to set request for all my method rpc(jsonrpc_method).But I don't know that how to passing request and handle request for my methods.
Please guide me, and give me some example.

Having trouble installing txjsonrpc via pip

I'm running this on Ubuntu 14.04 LTS.

archit@ip-10-0-1-117:~$ python --version
Python 2.7.6
archit@ip-10-0-1-117:~$ pip --version
pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)
archit@ip-10-0-1-117:~$ sudo pip install txJSON-RPC==0.3.1
The directory '/home/archit/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/archit/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting txJSON-RPC==0.3.1
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading txJSON-RPC-0.3.1.tar.gz (48kB)
    100% |████████████████████████████████| 51kB 5.9MB/s 
    Complete output from command python setup.py egg_info:
    Warning: '%s' not a legal ReST filename.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-5ZujeA/txJSON-RPC/setup.py", line 25, in <module>
        out=True),
      File "txjsonrpc/util/dist.py", line 117, in catReST
        report = validateReST(res)
      File "txjsonrpc/util/dist.py", line 82, in validateReST
        return _validateReST(text)
      File "txjsonrpc/util/dist.py", line 72, in _validateReST
        parser.parse(text, doc)
      File "/usr/local/lib/python2.7/dist-packages/docutils/parsers/rst/__init__.py", line 185, in parse
        self.statemachine.run(inputlines, document, inliner=self.inliner)
      File "/usr/local/lib/python2.7/dist-packages/docutils/parsers/rst/states.py", line 157, in run
        inliner.init_customizations(document.settings)
      File "/usr/local/lib/python2.7/dist-packages/docutils/parsers/rst/states.py", line 470, in init_customizations
        if settings.character_level_inline_markup:
    AttributeError: Values instance has no attribute 'character_level_inline_markup'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-5ZujeA/txJSON-RPC/
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
archit@ip-10-0-1-117:~$ 

(minor) Invalid use of formatting string.

Formatting string used with no args: txjsonrpc.util.dist, L103.

Discovered by way of setup.py output:

Installing collected packages: txjson-rpc
  Running setup.py install for txjson-rpc
    Warning: '%s' not a legal ReST filename.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.