Server classes

class ngamsServer.ngamsServer.ngamsHttpRequestHandler(request, client_address, server)

Class used to handle an HTTP request. The various send_* methods should make it easy for the rest of the code to send different kind of replies to users

proxy_request(host_id, host, port, timeout=300)

Proxy the current request to host:port

redirect(host, port)

Redirects the client to the requested path, but on host:port

send_data(data, mime_type, code=200, message=None, fname=None, hdrs={})

Sends back data, which is of type mime_type. If fname is given then the data is sent as an attachment.

send_file(f, mime_type, start_byte=0, fname=None, hdrs={})

Sends file f of type mime_type to the client. Optionally a different starting byte to start the transmission from, and a different name for the file to present the data to the user can be given.

send_file_headers(fname, mime_type, size, start_byte=0, hdrs={})

Sends the headers advertising file fname, but without its data. Headers set by this method take precedence over values given by the caller via the hdrs optional argument

send_ingest_status(msg, disk_info)

Reply to the client with a standard ingest status XML document

send_response(code, message=None, hdrs={})

Sends the initial status line plus headers to the client, can’t be called twice

send_status(message, status='SUCCESS', code=None, http_message=None, hdrs={})

Creates and sends an NGAS status XML document back to the client

class ngamsServer.ngamsServer.ngamsServer(cfg_fname, _cert=None)

Class providing the functionality of the NG/AMS Server.

cfg = None

The underlying configuration object of type ngamsConfig

db = None

A reference to the underlying database of type ngamsDb