| tierno | 0aef0db | 2018-02-01 19:13:07 +0100 | [diff] [blame] | 1 | |
| 2 | from http import HTTPStatus |
| 3 | |
| tierno | ae50192 | 2018-02-06 23:17:16 +0100 | [diff] [blame] | 4 | __author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>" |
| 5 | |
| tierno | 0aef0db | 2018-02-01 19:13:07 +0100 | [diff] [blame] | 6 | |
| 7 | class MsgException(Exception): |
| 8 | """ |
| 9 | Base Exception class for all msgXXXX exceptions |
| 10 | """ |
| 11 | |
| 12 | def __init__(self, message, http_code=HTTPStatus.INTERNAL_SERVER_ERROR): |
| 13 | """ |
| 14 | General exception |
| 15 | :param message: descriptive text |
| 16 | :param http_code: <http.HTTPStatus> type. It contains ".value" (http error code) and ".name" (http error name |
| 17 | """ |
| 18 | self.http_code = http_code |
| tierno | ae50192 | 2018-02-06 23:17:16 +0100 | [diff] [blame] | 19 | Exception.__init__(self, "messaging exception " + message) |
| tierno | 0aef0db | 2018-02-01 19:13:07 +0100 | [diff] [blame] | 20 | |
| 21 | |
| 22 | class MsgBase(object): |
| 23 | """ |
| 24 | Base class for all msgXXXX classes |
| 25 | """ |
| 26 | |
| 27 | def __init__(self): |
| 28 | pass |
| 29 | |
| 30 | def connect(self, config): |
| 31 | pass |
| 32 | |
| 33 | def write(self, msg): |
| 34 | pass |
| 35 | |
| 36 | def read(self): |
| 37 | pass |
| 38 | |
| 39 | def disconnect(self): |
| 40 | pass |
| 41 | |