comparison README.txt @ 15:3c19ae16fc7a

Renamed to AuthRPC
author Ben Croston <ben@croston.org>
date Mon, 05 Sep 2011 21:18:18 +0100
parents ad5a8748afcf
children 686b998428de
comparison
equal deleted inserted replaced
14:45c1d78559e2 15:3c19ae16fc7a
1 With python 3.x, only the client package is available at the moment, until WebOb has been ported to python 3. 1 This package provides a service based on JSONRPC with some small additions to the standard in order to enable authenticated requests. The WSGI specification is used for data communication. The package is broken down into two halves - a client and a server. For security, the server is best run over HTTPS, although this is not enforced.
2 2
3 The server depends on WebOb 1.0.0 and above. This is automatically installed if you have an internet connection, otherwise download and install from http://pypi.python.org/pypi/WebOb 3 The server depends on WebOb 1.0.0 and above. This is automatically installed if you have an internet connection, otherwise download and install from http://pypi.python.org/pypi/WebOb
4 4
5 If you install under Python 3, only the client package is available at the moment, until WebOb has been ported to python 3.
6
7 Example Usage (Server):
8
9 ::
10
11 import hashlib
12 from wsgiref import simple_server
13 from authrpc.server import AuthRPCApp
14
15 def myauth(username, password, useragent):
16 return username == 'myuser' and \
17 password == hashlib.md5('secret').hexdigest() and \
18 useragent == 'myprogram'
19
20 class api(object):
21 def do_something(self, myvar):
22 """Your code placed here"""
23 return 'Something', myvar
24
25 application = AuthRPCApp(api(), auth=myauth)
26 return simple_server.make_server('localhost', 1234, application)
27
28 Example Usage (Client):
29
30 ::
31
32 from AuthRPC.client import ServerProxy
33 client = ServerProxy('http://localhost:1234/',
34 username='myuser',
35 password='secret',
36 user_agent='myprogram')
37 retval = client.do_something('test')
38