Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Python Programming Language

Basic Auth for simple web server


Hi, I'm a Python newbie;
I have to write a simple webserver, and I need to
implement a basic authentication as specified in the RFC2617.
I wonder if there is a Python library for doing that.

Thanks!

--
Marco Aloisio

On Jun 5, 4:28 pm, Marco Aloisio <m@valis-e.com> wrote:

> Hi, I'm a Python newbie;
> I have to write a simple webserver, and I need to
> implement a basic authentication as specified in the RFC2617.
> I wonder if there is a Python library for doing that.

> Thanks!

> --
> Marco Aloisio

Have a look at paste (http://pythonpaste.org/).

For instance, to enable authentication for user foo, you can do the
following

    from paste.auth.basic import AuthBasicHandler

    def only_for_foo(env, user, passwd):
        return user == 'foo' and passwd = 'bar'

    auth_app = AuthBasicHandler(
        myapp, 'app realm', only_for_foo)

(where myapp is your WSGI application, of course).

                 Michele Simionato

Marco Aloisio <m@valis-e.com> writes:
> Hi, I'm a Python newbie;
> I have to write a simple webserver, and I need to
> implement a basic authentication as specified in the RFC2617.
> I wonder if there is a Python library for doing that.

twisted.web2 is one.

John

Thanks

--
Marco Aloisio

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc