Re: secure xmlrpc server?

2006-06-07 Thread Jeethu Rao
Using Twisted on the server side for xmlrpc doesn't restrict your 
options to using only Twisted on the client side.
Nothing prevents you from using xmlrpclib.ServerProxy on the client side.

Jeethu Rao

Laszlo Nagy wrote:
>   Hello,
>
> I'm trying to create a simple XMLRPC server and a client. It is a small 
> application, but the connection needs to be secure. I would like the 
> client to be as thin as possible. Ideally, the client should only 
> require the basic python library, nothing else. I found many examples on 
> the net. But I could not find secure ones (except twisted/xmlrpc, but I 
> would like to use the basic python lib on the client side, if possible). 
> I know that python supports HTTPS. In theory, this could be used to 
> bulild a secure xmlrpc server. I think that the client would work with 
> this code:
>
> # Connect to server
> server = ServerProxy("https://myserver.com:8000";)
>
> But I do not know how to create an XML RPC server in Python that uses 
> HTTPS for XML transports.  (The server may use other libraries, just the 
> client needs to be thin.)
> Can you help me please?
>
> Thanks,
>
>Laszlo
>
>   

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python socket proxy

2006-06-07 Thread Jeethu Rao
Simplest way would be to rename your python file with a .pyw extension 
instead of a .py extension.
If you're looking for windows services, checkout 
win32serviceutil.ServiceFramework in pywin32.

Jeethu Rao
 
[EMAIL PROTECTED] wrote:
> Hi
>
> Thanks for the reply.
>
> I found a proxy that works for me. Now I would like to know if its
> possible to run a python script, so its not visible in the cmd window
> (windows, i know, its bad :-) ) Maybe run it as a windows service?
>
>
>
> Filip Wasilewski wrote:
>   
>> [EMAIL PROTECTED] wrote:
>> 
>>> Hi all
>>>
>>> I am trying to create a lighweight tcp proxy server.
>>>   
>> [...]
>>
>> There is a bunch of nice recipies in the Python Cookbook on port
>> forwarding. In the [1] and [2] case it should be fairly simple to add
>> an extra authentication step with pyOpenSSL.
>>
>> [1] http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/483730
>> [2] http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/114642
>> [3] http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/483732
>>
>> best,
>> fw
>> 
>
>   

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python to PHP Login System (HTTP Post)

2006-06-22 Thread Jeethu Rao
You need to use httplib.
http://docs.python.org/lib/httplib-examples.html

Jeethu Rao
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PEP thought experiment: Unix style exec for function/method calls

2006-06-26 Thread Jeethu Rao
This reminds me of an silly little optimization  I used to use all the 
times when coding in assembler on PIC MCUs.
A call followed by a return can be turned into jump. Saves one 
instruction and one level on the call stack.
I think most optimizing compilers already do something of this sort, at 
least in the embedded world :)

Jeethu Rao

Michael wrote:
> Hi,
>
>
> [ I'm calling this PEP thought experiment because I'm discussing language
>   ideas for python which if implemented would probably be quite powerful
>   and useful, but the increased risk of obfuscation when the ideas are
>   used outside my expected/desired problem domain probably massively
>   outweigh the benefits. (if you're wondering why, it's akin to adding
>   a structured goto with context)
>
>   However I think as a thought experiment it's quite useful, since any
>   language feature can be implemented in different ways, and I'm wondering
>   if anyone's tried this, or if it's come up before (I can't find either
>   if they have...). ]
>
> I'm having difficulty finding any previous discussion on this --  I
> keep finding people either having problems calling os.exec(lepev), or
> with using python's exec statement. Neither of which I mean here.
>
> Just for a moment, let's just take one definition for one of the
> os.exec* commands:
>
> execv(...)
> execv(path, args)
>
> Execute an executable path with arguments, replacing current
> process.
> path: path of executable file
> args: tuple or list of strings
>
> Also: Note that execv inherits the system environment.
>
> Suppose we could do the same for a python function - suppose we could
> call the python function but either /without/ creating a new stack
> frame or /replacing/ the current stack frame with the new one.
>
> Anyway, I've been thinking recently that the same capability in python
> would be useful. However, almost any possible language feature:
>* Has probably already been discussed to death in the past
>* There's often a nice idiom working around the lack of said feature.
>
> So I'm more on an exploratory forage than asking for a language change
> here ;)
>
> Since os.exec* exists and "exec" already  exists in python, I need to
> differentiate what I mean by a unix style exec from python. So for
> convenience I'll call it "cexe".
>
> Now, suppose I have:
> --
> def set_name():
> name = raw_input("Enter your name! > ")
> cexe greet()
>
> def greet():
> print "hello", name
>
> cexe set_name()
> print "We don't reach here"
> --
>
> This would execute, ask for the user's name, say hello to them and then
> exit - not reaching the final print "We don't reach here" statement.
>
> Let's ignore for the moment that this example sucks (and is a good example
> of the danger of this as a language feature), what I want to do here is
> use this to explain the meaning of "cexe".
>
> There's two cases to consider:
>   cexe some_func_noargs()
>
> This transfers execution to the function that would normally be called
> if I simply called without using "cexe" some_func_noargs() . However,
> unlike a function call, we're /replacing/ the current thread of
> execution with the thread of execution in some_func_noargs(), rather
> than stacking the current location, in order to come back to later.
>
> ie, in the above this could also be viewed as "call without creating a
> new return point" or "call without bothering to create a new stack
> frame".
>
> It's this last point why in the above example "name" leaks between the
> two function calls - due to it being used as a cexe call.
>
> Case 2:
>   given...
>  def some_func_withargs(colour,tone, *listopts, **dictopts)
>
>   consider...
>  cexe some_func_withargs(foo,bar, *argv, **argd)
>
>  This would be much the same as the previous case, except in the new
>  execution point, the name colour & tone map to the values foo & bar had
>  in the original context, whilst listopts and dictopts map the values
>  that argv & argd had in the original content)
>
> One consequence here though is that in actual practice the final print
> statement of the code above never actually gets executed. (Much like if
> that was inside a function, writing something after "return foo", wouldn't
> be executed)
>
> The reason I'

Re: class instance scope

2006-07-24 Thread Jeethu Rao
You could possibly make the log class a singleton or a borg.

Jeethu Rao

Ritesh Raj Sarraf wrote:
>>> log = foo.log(x, y, z)
>>>
>>>   
>
> Resulting line is:
> log = foo.log(x, y, z)
> global log
>
> Making the instance "log" global makes it accessible to all the
> functions.
>
> Now I have only one question, Is this a correct way to do it ? Or are
> there better way ?
>
> Ritesh
>
>   

-- 
http://mail.python.org/mailman/listinfo/python-list