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 9122967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:13:39+00:00 2026-06-17T06:13:39+00:00

I define a python xmlrpc server as follows (approximate example for the purpose of

  • 0

I define a python xmlrpc server as follows (approximate example for the purpose of explaining things only):

from SimpleXMLRPCServer import SimpleXMLRPCServer
server = SimpleXMLRPCServer(('localhost', 8000))
server.register_function(foo, "serial.send")
server.serve_forever()

Then I can use a xmlrpc client like the following

import xmlrpclib
device = xmlrpclib.ServerProxy("http://localhost:8000/RPC2")
device.serial.send(...)

Here I can check if device is an instance of xmlrpclib.ServerProxy with

isinstance(device, xmlrpclib.ServerProxy)

but what is device.serial? I want to check that device.serial belongs to an xmlrpc, and not, for instance, to serial, socket or something else.

Here is a concrete example of what I want to check:

def foo(x):
   if isinstance(x, ...):
       print("xmlrpc access")
   else:
       print("direct access")

foo(device.serial) # expected output: 'xmlrpc access'
foo(serial.Serial(..)) # expected output: 'direct access'
foo(socket.Socket(...)) # expected outcome: 'direct access'
  • 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-17T06:13:40+00:00Added an answer on June 17, 2026 at 6:13 am

    If you are asking for arbitrary inspection of Python objects then use the ‘inspect’
    module of Python:

    http://www.ibm.com/developerworks/library/l-pyint/index.html

    also checking

    >> obj.__class__
    

    or

    >> obj.__class__.__bases__
    

    gives you access to the base classes.

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

Sidebar

Related Questions

I have simple xmlrpc server code: from SimpleXMLRPCServer import SimpleXMLRPCServer port = 9999 def
In Python I can define a function as follows: def func(kw1=None,kw2=None,**kwargs): ... In this
I tried to define my own exception class in python 2.7, deriving from BaseException
Say I am in the python interpreter and define a function as follows: def
I'm trying to pass arbitrary exceptions from a XMLRPC server to a client (both
I know I can define default parameters in python, but can I do so
i want to define an array in python . how would i do that
How can I define anonymous functions in python, where the bahaviour should depend on
Python's logging module lets modules or classes define their own loggers. And different loggers
Is it possible to define a recursive list comprehension in Python? Possibly a simplistic

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.