Package pyfics
[hide private]

Source Code for Package pyfics

 1  #!/usr/bin/env python 
 2  # -*- coding: utf-8 -*- 
 3  # vim: set sw=4 ts=4 sts=4 et tw=79 : 
 4  # Copyright 2006-2007 Ali Polatel <polatel@gmail.com> 
 5  # Distributed under the terms of the GNU General Public License v3 
 6   
 7  r"""pyfics - Python interface to ics chess servers. 
 8   
 9  Requirements 
10  ============ 
11      - U{Python <http://www.python.org>} 
12      - U{Twisted <http://www.twistedmatrix.com/>} 
13      - U{pyparsing <http://pyparsing.wikispaces.com/>} 
14  Examples 
15  ======== 
16      A simple example: 
17   
18      >>> from twisted.internet.protocol import ReconnectingClientFactory 
19      >>> from twisted.internet import reactor 
20      >>> from pyfics.protocols import InteractiveIcsParsingProtocol 
21      >>> from pyfics.parser import ficsparser 
22      >>> from pyfics.server import fics 
23      >>> ics = fics.Fics() 
24      >>> ics.login = 'username' 
25      >>> ics.password = 'password' 
26      >>> 
27      >>> class MyProtocol(InteractiveIcsParsingProtocol): 
28      ...     delimiters = [ 'fics% ', ] 
29      ...     server = ics 
30      ...     parser = ficsparser 
31      ... 
32      ...     def datagramReceived(self, data): 
33      ...         print repr(data) 
34      ... 
35      >>> c = ReconnectingClientFactory 
36      >>> c.protocol = MyProtocol 
37      >>> 
38      >>> reactor.connectTCP('freechess.org', 5000, c()) 
39      >>> reactor.run() 
40  """ 
41   
42  __author__ = 'Ali Polatel <polatel@gmail.com>' 
43  __copyright__ = 'Copyright (c) 2006-2007 Ali Polatel' 
44  __license__ = 'GPL-3' 
45  __version__ = '0.1' 
46