def get_with_response_json(params: Dict[str, Any]) -> AiohttpAction: url = "https://httpbin.org/get" callbacks = aiohttp_queue.ActionCallbacks( success=[AQ_callbacks.ResponseContentToJson()]) test_action = build_get_test_action( "get_with_response_json", url=url, params=params, callbacks=callbacks, max_attempts=3, ) return test_action
def get_list_of_dicts_result(url_params: Dict, params: Dict) -> AiohttpAction: url_template = Template( "https://esi.evetech.net/latest/markets/${region_id}/history") url = url_template.substitute(url_params) callbacks = aiohttp_queue.ActionCallbacks( success=[AQ_callbacks.ResponseContentToJson()]) test_action = build_get_test_action( "get_list_of_dicts_result", url=url, params=params, callbacks=callbacks, max_attempts=3, ) return test_action
def get_with_response_json_delay(params: Dict[str, Any], max_delay: int) -> AiohttpAction: delay = random.randint(0, max_delay) url = f"https://httpbin.org/delay/{delay}" callbacks = aiohttp_queue.ActionCallbacks( success=[AQ_callbacks.ResponseContentToJson()]) test_action = build_get_test_action( "get_with_response_json", url=url, params=params, callbacks=callbacks, max_attempts=3, ) return test_action
def action_with_out_pages() -> AiohttpAction: url_template = "https://esi.evetech.net/latest/markets/${region_id}/history" url_paramters = {"region_id": 10000002} template = Template(url_template) params: Dict = {"page": 1, "type_id": 34} aiohttp_request = AiohttpRequest( method="get", url=template.substitute(url_paramters), params=params, ) context: Dict = {} callbacks = ActionCallbacks(success=[AC.ResponseContentToJson()]) action = AiohttpAction( aiohttp_args=aiohttp_request, context=context, callbacks=callbacks, ) return action