0

I use the Spyne lib as soap web service and implement a interface to provide registration function for clients.

But I don't know how to get the client IP in function body.

    @srpc(String,String,String,_returns=String)
def register():
        #I need record client IP address
        return "hello"
leaf
  • 13
  • 2

1 Answers1

0

Change @srpc to @rpc like this:

@rpc(String,String,String,_returns=String)

def register(ctx, str1, str2, str3):

    #I need record client IP address
    print ctx.transport.req["REMOTE_ADDR"]
    return "hello"

As I understand, when you use @rpc it gives the function as the first parameter an object with all the information of configuration, headers and some methods.

Blastter
  • 1
  • 2