Frontik's PageHandler contains several methods for making HTTP requests to backends: get_url, post_url, put_url, etc...
Method parameters are:
host
- either host name with protocol or virtual host for balancing requestspath
- path starting with leading slashdata
- dict with request params or request body in case of POST requestsheaders
- dict with request headersconnect_timeout
- if present, overrides default connect timeoutrequest_timeout
- if present, overrides default request timeoutmax_timeout_tries
- multiplier for request timeout allowing retryingfollow_redirects
- allows http client to handle redirectswaited
- if set to False, main request handler will not wait this request to finishidempotent
- only for POST request. Makes request idempotent.parse_response
— if set toTrue
, Frontik will try to parse the response body (currently it supports XML and JSON content types) and pass parsed to result.data. If set toFalse
, the original response body string will be passed instead of the parsed response.parse_on_error
— if set toFalse
, Frontik will not parse the response body with status code >= 300. To change this behaviour, setparse_on_error=True
.
All requests are always added to main AsyncGroup, finish_group
,
except when waited
parameter is set to False
. Only after all requests
are finished, AsyncGroup is marked as completed and postprocessing
and templating takes place.
When host parameter equals one of configured virtual hosts, request will be retried unless following criteria met:
- Number of tries has exceeded
max_tries
value - Previous try resulted not in connect timeout or
retry_policy
forbids further tries based on status code and idempotence - Time allowed for request to finish has been exceeded