Package tlib :: Package base :: Module ApiMockServer :: Class _MyHandler |
[hide private]
[frames] | no frames]

# Class _MyHandler

source code

    SocketServer.BaseRequestHandler --+
                                      |
      SocketServer.StreamRequestHandler --+
                                          |
      BaseHTTPServer.BaseHTTPRequestHandler --+
                                              |
      SimpleHTTPServer.SimpleHTTPRequestHandler --+
                                                  |
                                                 _MyHandler

Class for handling POST and GET request to our mock server. To be used with the ApiMockServer

Nested Classes | [hide private]
Inherited from `BaseHTTPServer.BaseHTTPRequestHandler`: `MessageClass`

Instance Methods | [hide private]
__init__(self, req, client_addr, server) | source code
do_GET(self) Handles the GET requests for retrieving the mock data that was last stored in memory | source code
do_POST(self) Handles the POST request for putting a mock json response into memory for later retrieval with GET | source code
Inherited from `SimpleHTTPServer.SimpleHTTPRequestHandler`: `copyfile`, `do_HEAD`, `guess_type`, `list_directory`, `send_head`, `translate_path` Inherited from `BaseHTTPServer.BaseHTTPRequestHandler`: `address_string`, `date_time_string`, `end_headers`, `handle`, `handle_one_request`, `log_date_time_string`, `log_error`, `log_message`, `log_request`, `parse_request`, `send_error`, `send_header`, `send_response`, `version_string` Inherited from `SocketServer.StreamRequestHandler`: `finish`, `setup`

Class Variables | [hide private]
Inherited from `SimpleHTTPServer.SimpleHTTPRequestHandler`: `extensions_map`, `server_version` Inherited from `BaseHTTPServer.BaseHTTPRequestHandler`: `default_request_version`, `error_content_type`, `error_message_format`, `monthname`, `protocol_version`, `responses`, `sys_version`, `weekdayname` Inherited from `SocketServer.StreamRequestHandler`: `disable_nagle_algorithm`, `rbufsize`, `timeout`, `wbufsize`

Method Details | [hide private]

### __init__(self, req, client_addr, server) (Constructor) | source code
Overrides: SocketServer.BaseRequestHandler.__init__

### do_GET(self) | source code
Handles the GET requests for retrieving the mock data that was last stored in memory Returns : (json) 'warning' = "No data in memory" if nothing has been previously stored. Returns a mock json if something was previously stored. Overrides: SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET

### do_POST(self) | source code
Handles the POST request for putting a mock json response into memory for later retrieval with GET Returns : (json) 'data' = 'Data has been saved to memory' if the data sent successfully saved.