def _request_on_count(self, username, password, verify,<EOL>match_range=None, json_usr=None):
self.verify = verify<EOL>def _side_effect_request(<EOL>method, url,<EOL>params=None,<EOL>data=None,<EOL>headers=None,<EOL>cookies=None,<EOL>files=None,<EOL>auth=None,<EOL>timeout=None,<EOL>allow_redirects=True,<EOL>proxies=None,<EOL>hooks=None,<EOL>stream=None,<EOL>verify=None,<EOL>cert=None,<EOL>json=None):<EOL><INDENT>if not hasattr(self, "<STR_LIT:count>"):<EOL><INDENT>self.count = <NUM_LIT:0><EOL><DEDENT>headers = {'<STR_LIT>': '<STR_LIT:application/json>'}<EOL>if self.verify != verify:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>rsp = requests.models.Response<EOL>match = False<EOL>if match_range is not None:<EOL><INDENT>self.count += <NUM_LIT:1><EOL>match = self.count in match_range<EOL><DEDENT>if match:<EOL><INDENT>rsp.status_code = <NUM_LIT><EOL><DEDENT>elif method == "<STR_LIT:POST>" and "<STR_LIT>" in url:<EOL><INDENT>testdata = jsonutils.loads(data)<EOL>if (password != testdata['<STR_LIT>']['<STR_LIT>']['<STR_LIT>']):<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>if (username != testdata['<STR_LIT>']['<STR_LIT>']['<STR_LIT:name>']):<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>rsp.status_code = <NUM_LIT:200><EOL>rsp.headers = {'<STR_LIT>': '<STR_LIT>'}<EOL><DEDENT>elif method == "<STR_LIT:POST>" and "<STR_LIT>" in data:<EOL><INDENT>rsp.status_code = <NUM_LIT:200><EOL>rsp.headers = headers<EOL>rsp.json = self.json_cli<EOL><DEDENT>elif method == "<STR_LIT:GET>":<EOL><INDENT>rsp.status_code = <NUM_LIT:200><EOL>rsp.headers = headers<EOL>rsp.json = self.json<EOL><DEDENT>if json_usr:<EOL><INDENT>rsp.json = json_usr<EOL><DEDENT>return rsp<EOL><DEDENT>return _side_effect_request<EOL>
Generate side effect for restapi client Session.

        This method verifies the username, password, and verify settings
        are correct as input into restapi client request calls.  This
        verifies the credential data base is built correctly and
        arguments are fed into the restapi client apis correctly.

        Additionally, this method will set the status code to 403
        based on count to values in match_range list.  This
        status_code indicates the cookie has expired and needs to
        be refreshed to continue chatting with the host.

        Usage Example:

        The following call will verify username and password in the data
        for POST requests trying to do a AAAlogin. For all requests,
        the verify argument is checked against the verify arg passed into
        request.  On the 4th request call, it will return 403 which should
        force a cookie refresh.
        _request_on_count('admin', 'Shhh1', '/path/to/cafile.crt', ['4'])