Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Mar 31st, 2020 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from werkzeug.wrappers import Request, Response
  2. from werkzeug.serving import run_simple
  3.  
  4. from jsonrpc import JSONRPCResponseManager, dispatcher
  5.  
  6.  
  7. @dispatcher.add_method
  8. def foobar(uno, due):
  9.     return uno + due
  10.  
  11.  
  12. @dispatcher.add_method
  13. def sum_all(*args):
  14.     return sum(args)
  15.  
  16.  
  17. @Request.application
  18. def application(request):
  19.     # Dispatcher is dictionary {<method_name>: callable}
  20.     dispatcher["echo"] = lambda s: s
  21.     dispatcher["add"] = lambda a, b: a + b
  22.  
  23.     response = JSONRPCResponseManager.handle(
  24.         request.data, dispatcher)
  25.     return Response(response.json, mimetype='application/json')
  26.  
  27.  
  28. if __name__ == '__main__':
  29.     run_simple('localhost', 4000, application)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top