Tag: python

  • disabling output buffer from python scripts

    Today I encountered a weird problem while running a python script with nohup. I was not getting anything in the output file even after waiting for 2-3 minutes which was unusual as I have used nohup on countless occasions with bash scripts and had not seen this issue. Python itself buffers stdout and stderr which […]

  • proxy in xmlrpclib

    This is just an extension of the example shown here http://docs.python.org/library/xmlrpclib.html#example-of-client-usage . import xmlrpclib, httplib class ProxiedTransport(xmlrpclib.Transport): def set_proxy(self, proxy): self.proxy = proxy self.puser_pass = puser_pass def make_connection(self, host): self.realhost = host h = httplib.HTTP(self.proxy) return h def send_request(self, connection, handler, request_body): connection.putrequest(“POST”, ‘http://%s%s’ % (self.realhost, handler)) def send_host(self, connection, host): connection.putheader(‘Host’, self.realhost) connection.putheader(‘User-agent’, self.user_agent) […]