title: Python SimpleXMLRPCServer: get user IP and simple authentication
body: <p>I am trying to make a very simple XML RPC Server with Python that provides basic authentication + ability to obtain the connected user's IP. Let's take the example provided in <a href="http://docs.python.org/library/xmlrpclib.html" rel="nofollow">http://docs.python.org/library/xmlrpclib.html</a> :</p>
  
  <pre><code>import xmlrpclib
  from SimpleXMLRPCServer import SimpleXMLRPCServer
  
  def is_even(n):
      return n%2 == 0
  
  server = SimpleXMLRPCServer(("localhost", 8000))
  server.register_function(is_even, "is_even")
  server.serve_forever()
  </code></pre>
  
  <p>So now, the first idea behind this is to make the user supply credentials and process them before allowing him to use the functions. I need very simple authentication, for example just a code. Right now what I'm doing is to force the user to supply this code in the function call and test it with an if-statement.</p>
  
  <p>The second one is to be able to get the user IP when he calls a function or either store it after he connects to the server.</p>
  
  <p>Moreover, I already have an Apache Server running and it might be simpler to integrate this into it.</p>
  
  <p>What do you think?</p>