Python 3.x and TestLink xmlprc
Question: Appreciate your helping first, I am new for the python 3.x. When I try to use
Python 3.x to parse the testlink xmlprc server. I got below error, but I can
run the code under Python 2.x, any idea?

    
    
    import xmlrpc.client
    
    server = xmlrpc.client.Server("http://172.16.29.132/SITM/lib/api/xmlrpc.php") //here is my testlink server
    print (server.system.listMethods()) //I can print the methods list here
    print (server.tl.ping()) // Got error.
    

Here is the error:

    
    
    ['system.multicall', 'system.listMethods', 'system.getCapabilities', 'tl.repeat', 'tl.sayHello', 'tl.ping', 'tl.setTestMode', 'tl.about', 'tl.checkDevKey', 'tl.doesUserExist', 'tl.deleteExecution', 'tl.getTestSuiteByID', 'tl.getFullPath', 'tl.getTestCase', 'tl.getTestCaseAttachments', 'tl.getFirstLevelTestSuitesForTestProject', 'tl.getTestCaseCustomFieldDesignValue', 'tl.getTestCaseIDByName', 'tl.getTestCasesForTestPlan', 'tl.getTestCasesForTestSuite', 'tl.getTestSuitesForTestSuite', 'tl.getTestSuitesForTestPlan', 'tl.getLastExecutionResult', 'tl.getLatestBuildForTestPlan', 'tl.getBuildsForTestPlan', 'tl.getTotalsForTestPlan', 'tl.getTestPlanPlatforms', 'tl.getProjectTestPlans', 'tl.getTestPlanByName', 'tl.getTestProjectByName', 'tl.getProjects', 'tl.addTestCaseToTestPlan', 'tl.assignRequirements', 'tl.uploadAttachment', 'tl.uploadTestCaseAttachment', 'tl.uploadTestSuiteAttachment', 'tl.uploadTestProjectAttachment', 'tl.uploadRequirementAttachment', 'tl.uploadRequirementSpecificationAttachment', 'tl.uploadExecutionAttachment', 'tl.createTestSuite', 'tl.createTestProject', 'tl.createTestPlan', 'tl.createTestCase', 'tl.createBuild', 'tl.setTestCaseExecutionResult', 'tl.reportTCResult']
    Traceback (most recent call last):
     File "F:\SQA\Python\Testlink\Test.py", line 5, in <module>
      print (server.tl.ping())
     File "C:\Python31\lib\xmlrpc\client.py", line 1029, in __call__
      return self.__send(self.__name, args)
     File "C:\Python31\lib\xmlrpc\client.py", line 1271, in __request
      verbose=self.__verbose
     File "C:\Python31\lib\xmlrpc\client.py", line 1070, in request
      return self.parse_response(resp)
     File "C:\Python31\lib\xmlrpc\client.py", line 1164, in parse_response
      p.feed(response)
     File "C:\Python31\lib\xmlrpc\client.py", line 454, in feed
      self._parser.Parse(data, 0)
    xml.parsers.expat.ExpatError: junk after document element: line 2, column 0
    


Answer: When I've seen this message before, it happened because the contents of the
transported data wasn't escaped for XML transport. The solution was to wrap
the data in an _[XMLRPC Binary
object](http://docs.python.org/py3k/library/xmlrpc.client.html#binary-
objects)_.

In your case, you don't control the server side, so the above isn't a solution
for you but it may suggest what the actual problem is.

Also, the Python 2 versus Python 3 difference suggests that there is a
text/bytes issue at work.

To help diagnose the issue, set `verbose=True` so you can see the actual HTTP
request/response headers and the XML request/response. That may show you what
is at `line 2: column 0`. You may find that the issue may be with the PHP
script not wrapping up binary data in base64 encoding as required by the
[XMLRPC spec](http://xmlrpc.scripting.com/spec.html).

