Domanda

I am trying to follow this walkthrough on how to use the ServiceProxy in jsonrpc.

I followed the directions but I am getting an error no the import of the ServiceProxy.

Here is the code I am using:

#!usr/bin/python
import sys
import json
from jsonrpc import ServiceProxy

givex = jsonrpc.ServiceProxy()
print "foo"

which is resulting in:

enter image description here

Would anyone be able to help me out with some ideas on how to fix this, or have a suggestion for a better jsonrpc library to use.

È stato utile?

Soluzione

The tutoral you are following seems to be outdated. Try

from jsonrpc.proxy import JSONRPCProxy
givex = JSONRPCProxy.from_url("http://localhost/url/of/your/service.py")

Altri suggerimenti

If you are trying to run this under Python 3.x, bear in mind that it is not yet supported. Many JSON RPC libraries have very similar names, but this particular one (jsonrpc without the dash, different from json-rpc or jsonrpc2) does not support Python 3 as of december 2016.

Here is the link for this particular library: https://pypi.python.org/pypi/jsonrpc

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top