Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8042967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:45:32+00:00 2026-06-05T04:45:32+00:00

I am trying to make a very simple XML RPC Server with Python that

  • 0

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 http://docs.python.org/library/xmlrpclib.html :

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()

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.

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.

Moreover, I already have an Apache Server running and it might be simpler to integrate this into it.

What do you think?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T04:45:33+00:00Added an answer on June 5, 2026 at 4:45 am

    This is a related question that I found helpful:

    IP address of client in Python SimpleXMLRPCServer?

    What worked for me was to grab the client_address in an overridden finish_request method of the server, stash it in the server itself, and then access this in an overridden server _dispatch routine. You might be able to access the server itself from within the method, too, but I was just trying to add the IP address as an automatic first argument to all my method calls. The reason I used a dict was because I’m also going to add a session token and perhaps other metadata as well.

    from xmlrpc.server import DocXMLRPCServer
    from socketserver import BaseServer
    
    class NewXMLRPCServer( DocXMLRPCServer):
    
        def finish_request( self, request, client_address):
            self.client_address = client_address
            BaseServer.finish_request( self, request, client_address)
    
        def _dispatch( self, method, params):
            metadata = { 'client_address' : self.client_address[ 0] }
            newParams = ( metadata, ) + params
            return DocXMLRPCServer._dispatch( self, method, metadata)
    

    Note this will BREAK introspection functions like system.listMethods() because that isn’t expecting the extra argument. One idea would be to check the method name for “system.” and just pass the regular params in that case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a very simple iphone app that displays the real-time camera
I'm trying to make a very simple 'counter' that is supposed to keep track
I am currently trying to make a very simple C program for school that
i am trying to make a very simple program that invert the pixels position
I'm at the moment trying to make a very simple app that will greet
Im trying to make a very simple application that lets my client create their
I am trying to make a very simple object rotate around a fixed point
I am trying to make a very simple web-service which does the following: The
i'm trying to make a very simple YACC parser on Pascal language which just
I'm trying to make a very simple OSGi test but I can't get it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.