Mercurial > p > roundup > code
comparison roundup/rest.py @ 5556:d75aa88c2a99 REST-rebased
Added RestInstance and calling rest from client.py
committer: Ralf Schlatterbeck <rsc@runtux.com>
| author | Chau Nguyen <dangchau1991@yahoo.com> |
|---|---|
| date | Tue, 29 Jan 2019 15:27:37 +0100 |
| parents | |
| children | 213a56c91471 |
comparison
equal
deleted
inserted
replaced
| 5555:7b663b588292 | 5556:d75aa88c2a99 |
|---|---|
| 1 # Restful API for Roundup | |
| 2 # | |
| 3 # This module is free software, you may redistribute it | |
| 4 # and/or modify under the same terms as Python. | |
| 5 # | |
| 6 | |
| 7 import json | |
| 8 import pprint | |
| 9 | |
| 10 | |
| 11 class RestfulInstance(object): | |
| 12 """Dummy Handler for REST | |
| 13 """ | |
| 14 | |
| 15 def __init__(self, db): | |
| 16 # TODO: database, translator and instance.actions | |
| 17 self.db = db | |
| 18 | |
| 19 def dispatch(self, method, uri, input): | |
| 20 print method | |
| 21 print uri | |
| 22 print type(input) | |
| 23 pprint.pprint(input) | |
| 24 return ' '.join([method, uri, pprint.pformat(input)]) |
