Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
xmlrpclib Namespace Reference

Data Structures

class  Error
 
class  ProtocolError
 
class  ResponseError
 
class  Fault
 
class  Boolean
 
class  DateTime
 
class  Binary
 
class  SgmlopParser
 
class  ExpatParser
 
class  SlowParser
 
class  Marshaller
 
class  Unmarshaller
 
class  _Method
 
class  Transport
 
class  SafeTransport
 
class  ServerProxy
 

Functions

def escape
 
def boolean
 
def datetime
 
def binary
 
def getparser
 
def dumps
 
def loads
 

Variables

 unicode = None
 
int MAXINT = 2L
 
int MININT = -2L
 
string __version__ = "1.0.0"
 
 WRAPPERS = DateTime,Binary,Boolean
 
 FastParser = _xmlrpclib.Parser
 
 FastUnmarshaller = _xmlrpclib.Unmarshaller
 
 SgmlopParser = None
 
 ExpatParser = None
 
 Server = ServerProxy
 
tuple server = ServerProxy("http://betty.userland.com")
 

Function Documentation

def xmlrpclib.binary (   data)

Definition at line 298 of file xmlrpclib.py.

299 def binary(data):
300  value = Binary()
301  value.decode(data)
302  return value
def xmlrpclib.boolean (   value,
  truefalse = (False, True 
)
Convert any Python value to XML-RPC 'boolean'.

Definition at line 237 of file xmlrpclib.py.

238 def boolean(value, truefalse=(False, True)):
239  """Convert any Python value to XML-RPC 'boolean'."""
240  return truefalse[operator.truth(value)]
def xmlrpclib.datetime (   data)

Definition at line 272 of file xmlrpclib.py.

273 def datetime(data):
274  value = DateTime()
275  value.decode(data)
276  return value
def xmlrpclib.dumps (   params,
  methodname = None,
  methodresponse = None,
  encoding = None 
)
data [,options] -> marshalled data

Convert an argument tuple or a Fault instance to an XML-RPC
request (or response, if the methodresponse option is used).

In addition to the data object, the following options can be given
as keyword arguments:

    methodname: the method name for a methodCall packet

    methodresponse: true to create a methodResponse packet.
    If this option is used with a tuple, the tuple must be
    a singleton (i.e. it can contain only one element).

    encoding: the packet encoding (default is UTF-8)

All 8-bit strings in the data structure are assumed to use the
packet encoding.  Unicode strings are automatically converted,
where necessary.

Definition at line 729 of file xmlrpclib.py.

References string.join().

730 def dumps(params, methodname=None, methodresponse=None, encoding=None):
731  """data [,options] -> marshalled data
732 
733  Convert an argument tuple or a Fault instance to an XML-RPC
734  request (or response, if the methodresponse option is used).
735 
736  In addition to the data object, the following options can be given
737  as keyword arguments:
738 
739  methodname: the method name for a methodCall packet
740 
741  methodresponse: true to create a methodResponse packet.
742  If this option is used with a tuple, the tuple must be
743  a singleton (i.e. it can contain only one element).
744 
745  encoding: the packet encoding (default is UTF-8)
746 
747  All 8-bit strings in the data structure are assumed to use the
748  packet encoding. Unicode strings are automatically converted,
749  where necessary.
750  """
751 
752  assert isinstance(params, TupleType) or isinstance(params, Fault),\
753  "argument must be tuple or Fault instance"
754 
755  if isinstance(params, Fault):
756  methodresponse = 1
757  elif methodresponse and isinstance(params, TupleType):
758  assert len(params) == 1, "response tuple must be a singleton"
759 
760  if not encoding:
761  encoding = "utf-8"
762 
763  m = Marshaller(encoding)
764  data = m.dumps(params)
765 
766  if encoding != "utf-8":
767  xmlheader = "<?xml version='1.0' encoding=%s?>\n" % repr(encoding)
768  else:
769  xmlheader = "<?xml version='1.0'?>\n" # utf-8 is default
770 
771  # standard XML-RPC wrappings
772  if methodname:
773  # a method call
774  if not isinstance(methodname, StringType):
775  methodname = methodname.encode(encoding)
776  data = (
777  xmlheader,
778  "<methodCall>\n"
779  "<methodName>", methodname, "</methodName>\n",
780  data,
781  "</methodCall>\n"
782  )
783  elif methodresponse:
784  # a method response, or a fault structure
785  data = (
786  xmlheader,
787  "<methodResponse>\n",
788  data,
789  "</methodResponse>\n"
790  )
791  else:
792  return data # return as is
793  return string.join(data, "")
def xmlrpclib.escape (   s,
  replace = string.replace 
)

Definition at line 144 of file xmlrpclib.py.

References pydoc.replace().

145 def escape(s, replace=string.replace):
146  s = replace(s, "&", "&amp;")
147  s = replace(s, "<", "&lt;")
148  return replace(s, ">", "&gt;",)
def xmlrpclib.getparser ( )
getparser() -> parser, unmarshaller

Create an instance of the fastest available parser, and attach it
to an unmarshalling object.  Return both objects.

Definition at line 708 of file xmlrpclib.py.

References FastParser, and FastUnmarshaller.

709 def getparser():
710  """getparser() -> parser, unmarshaller
711 
712  Create an instance of the fastest available parser, and attach it
713  to an unmarshalling object. Return both objects.
714  """
715  if FastParser and FastUnmarshaller:
716  target = FastUnmarshaller(True, False, binary, datetime)
717  parser = FastParser(target)
718  else:
719  target = Unmarshaller()
720  if FastParser:
721  parser = FastParser(target)
722  elif SgmlopParser:
723  parser = SgmlopParser(target)
724  elif ExpatParser:
725  parser = ExpatParser(target)
726  else:
727  parser = SlowParser(target)
728  return parser, target
def xmlrpclib.loads (   data)
data -> unmarshalled data, method name

Convert an XML-RPC packet to unmarshalled data plus a method
name (None if not present).

If the XML-RPC packet represents a fault condition, this function
raises a Fault exception.

Definition at line 794 of file xmlrpclib.py.

References getparser().

795 def loads(data):
796  """data -> unmarshalled data, method name
797 
798  Convert an XML-RPC packet to unmarshalled data plus a method
799  name (None if not present).
800 
801  If the XML-RPC packet represents a fault condition, this function
802  raises a Fault exception.
803  """
804  p, u = getparser()
805  p.feed(data)
806  p.close()
807  return u.close(), u.getmethodname()
808 
809 
810 # --------------------------------------------------------------------
811 # request dispatcher

Variable Documentation

string __version__ = "1.0.0"

Definition at line 163 of file xmlrpclib.py.

ExpatParser = None

Definition at line 373 of file xmlrpclib.py.

FastParser = _xmlrpclib.Parser

Definition at line 312 of file xmlrpclib.py.

FastUnmarshaller = _xmlrpclib.Unmarshaller

Definition at line 313 of file xmlrpclib.py.

int MAXINT = 2L

Definition at line 149 of file xmlrpclib.py.

int MININT = -2L

Definition at line 150 of file xmlrpclib.py.

Server = ServerProxy

Definition at line 999 of file xmlrpclib.py.

tuple server = ServerProxy("http://betty.userland.com")

Definition at line 1009 of file xmlrpclib.py.

SgmlopParser = None

Definition at line 329 of file xmlrpclib.py.

unicode = None

Definition at line 136 of file xmlrpclib.py.

WRAPPERS = DateTime,Binary,Boolean

Definition at line 303 of file xmlrpclib.py.