xmlrpclib

Unable to use custom Transport class with python xmlrpclib due to TypeError: unbound method request()

廉价感情. 提交于 2019-12-12 03:53:32
问题 I am trying to use a custom Transport class with xmlrpclib in Python but when I specify a custom Transport, I do get an exception at the first call: File "/Users/sorins/dev/py/confluence/confluence/confluence.py", line 208, in __init__ self._token = self._server.confluence1.login(username, password) File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1224, in __call__ return self.__send(self.__name, args) File "/usr/local/Cellar

Python: Is it possible to set the clientport with xmlrpclib?

三世轮回 提交于 2019-12-12 02:06:44
问题 Is it possible to set the clientport for the xmlrpc-connection? I want to say: Client should make a ServerProxy-object to over a specific client port or pseudocode something like this: serv = xmlrpclib.ServerProxy("server:port","overSpecificClientPort"). 回答1: Try to define a custom transport. This should be something like that: import xmlrpclib, httplib class sourcedTransport(xmlrpclib.Transport): def setSource(self, src): self.src = src def make_connection(self, host): h = httplib

Does XML-RPC in general allows to call few functions at once?

萝らか妹 提交于 2019-12-11 16:15:32
问题 Can I ask for few question in one post to XML-RPC server? If yes, how can I do it in python and xmlrpclib? I'm using XML-RPC server on slow connection, so I would like to call few functions at once, because each call costs me 700ms. 回答1: http://docs.python.org/library/xmlrpclib.html#multicall-objects 回答2: Whether or not possible support of multicall makes any difference to you depends on where the 700ms is going. How did you measure your 700ms? Run a packet capture of a query and analyse the

QThreads and xmlrpc client

删除回忆录丶 提交于 2019-12-11 09:44:10
问题 I'm trying to use xmlrpc client from many QThreads. To make sure that only one thread is using xmlrpc client I created lock with QMutex. My code: import sys import xmlrpclib import threading import time from SimpleXMLRPCServer import SimpleXMLRPCServer from PyQt4 import QtCore, QtGui class MM(object): def __init__(self): self.lock = QtCore.QMutex() self.xmlrpc_client = xmlrpclib.ServerProxy('http://localhost:9092') def __getattr__(self, name): self.lock.lock() sys.stderr.write('locked, for %s

Errors while converting Python script to Ruby

拥有回忆 提交于 2019-12-10 21:31:37
问题 I am using a Python script which uses xmlrpclib : import xmlrpclib srv = xmlrpclib.ServerProxy("http://demo.myslice.info:7080/", allow_none=True) # authentication token auth = {"AuthMethod": "password", "Username": "guest", "AuthString": "guest"} ret = srv.Get(auth, "slice", [["slice_hrn", '=', "ple.upmc.myslicedemo"]], {}, ["slice_hrn"]) print ret I want to make a similar XML-RPC call using Ruby. For this purpose I have used the following code: require "xmlrpc/client" require "pp" XMLRPC:

Can XML-RPC methods be called by name (as strings) in Python?

守給你的承諾、 提交于 2019-12-10 10:32:49
问题 In python, calling XML-RPC methods involves invoking methods on a proxy object: from xmlrpclib import ServerProxy print ServerProxy('https://example.com/rpc').api.hello_there('John') In some other languages, like perl, you pass your method name as a method parameter. use Frontier::Client; $p = Frontier::Client->new(url => 'https://example.com/rpc'); $result = $p->call('api.hello_there', 'John'); print $result; Is there a way to invoke XML-RPC methods by name, as strings, in Python? 回答1: Just

Python. Tornado. Non-blocking xmlrpc client

旧城冷巷雨未停 提交于 2019-12-09 13:51:18
问题 Basically we can call xmlrpc handlers following way: import xmlrpclib s = xmlrpclib.ServerProxy('http://remote_host/rpc/') print s.system.listmethods() In tornado we can integrate it like this: import xmlrpclib import tornado.web s = xmlrpclib.ServerProxy('http://remote_host/rpc/') class MyHandler(tornado.web.RequestHandler): def get(self): result = s.system.listmethods() I have following, a little bit newbie, questions: Will result = s.system.listmethods() block tornado? Are there any non

How to install xmlrpclib in python 3.4?

╄→гoц情女王★ 提交于 2019-12-06 19:12:26
问题 When I am trying to install xmlrpclib, I am getting following error in python version 3.4 Downloading/unpacking xmlrpclib Could not find any downloads that satisfy the requirement xmlrpclib Some externally hosted files were ignored (use --allow-external xmlrpclib to allow). Cleaning up... No distributions at all found for xmlrpclib Storing debug log for failure in /home/shiva/.pip/pip.log How to install xmlrpclib in python 3.4 ? 回答1: xmlrpclib is part of the standard library in Python 2.x. It

XML-RPC returning value before executing all function code

元气小坏坏 提交于 2019-12-06 06:13:21
I have XML-RPC server: import time import xmlrpclib from SimpleXMLRPCServer import SimpleXMLRPCServer class Worker(object): def start_work(self): # is it possible do return value to client here? self.do_work() return 'we started!' def do_work(self): while(True): print 'I\'m doing work...' time.sleep(3) if __name__ == '__main__': port = 8080 server = SimpleXMLRPCServer(("localhost", port)) print "Listening on port %s..." % port w = Worker() server.register_function(w.start_work) while(1): server.handle_request() # vim: filetype=python syntax=python expandtab shiftwidth=4 softtabstop=4 encoding

Using gevent with python xmlrpclib

被刻印的时光 ゝ 提交于 2019-12-06 05:37:08
问题 Is it possible to use python's standard libs xmlrpclib with gevent? Currently i'm tried to use monkey.patch_all(), but without success. from gevent import monkey monkey.patch_all() import gevent import time import xmlrpclib from SimpleXMLRPCServer import SimpleXMLRPCServer import urllib2 def fetch(url): g = gevent.spawn(urllib2.urlopen, url) return g.get().read() def is_even(n): return n%2 == 0 def req(url): return fetch(url) server = SimpleXMLRPCServer(("localhost", 8000)) print "Listening