pip_services3_rpc.services.HttpRequestDetector module

class pip_services3_rpc.services.HttpRequestDetector.HttpRequestDetector

Bases: object

Helper class that retrieves parameters from HTTP requests.

static detect_address(req: bottle.BaseRequest) str

Detects the IP address from which the given HTTP request was received.

Parameters

req – an HTTP request to process.

Returns

the detected IP address (without a port). If no IP is detected -

None will be returned.

static detect_browser(req: bottle.BaseRequest) str

Detects the browser (using “user-agent”) from which the given HTTP request was made.

Parameters

req – an HTTP request to process.

Returns

the detected browser. Detectable browsers: “chrome”, “msie”, “firefox”,

“safari”. Otherwise - “unknown” will be returned.

static detect_platform(req: bottle.BaseRequest) str

Detects the platform (using “user-agent”) from which the given HTTP request was made.

Parameters

req – an HTTP request to process.

Returns

the detected platform and version. Detectable platforms: “mobile”, “iphone”,

“ipad”, “macosx”, “android”, “webos”, “mac”, “windows”. Otherwise - “unknown” will be returned.

static detect_server_host(req: bottle.BaseRequest) str

Detects the host name of the request’s destination server.

Parameters

req – an HTTP request to process.

Returns

the destination server’s host name.

static detect_server_port(req: bottle.BaseRequest) str

Detects the request’s destination port number.

Parameters

req – an HTTP request to process.

Returns

the detected port number or 80 (if none are detected).