aioresponses package

Submodules

aioresponses.core module

class aioresponses.core.CallbackResult(method: str = 'GET', status: int = 200, body: str = '', content_type: str = 'application/json', payload: Dict[KT, VT] = None, headers: Dict[KT, VT] = None, response_class: Optional[aiohttp.client_reqrep.ClientResponse] = None, reason: Optional[str] = None)[source]

Bases: object

class aioresponses.core.RequestCall(args, kwargs)

Bases: tuple

args

Alias for field number 0

kwargs

Alias for field number 1

class aioresponses.core.RequestMatch(url: Union[yarl.URL, str, re.Pattern], method: str = 'GET', status: int = 200, body: str = '', payload: Dict[KT, VT] = None, exception: Optional[Exception] = None, headers: Dict[KT, VT] = None, content_type: str = 'application/json', response_class: Optional[aiohttp.client_reqrep.ClientResponse] = None, timeout: bool = False, repeat: bool = False, reason: Optional[str] = None, callback: Optional[Callable] = None)[source]

Bases: object

build_response(url: yarl.URL, **kwargs) → Union[aiohttp.client_reqrep.ClientResponse, Exception][source]
match(method: str, url: yarl.URL) → bool[source]
match_regexp(url: yarl.URL) → bool[source]
match_str(url: yarl.URL) → bool[source]
url_or_pattern = None
class aioresponses.core.aioresponses(**kwargs)[source]

Bases: object

Mock aiohttp requests made by ClientSession.

add(url: Union[yarl.URL, str, re.Pattern], method: str = 'GET', status: int = 200, body: str = '', exception: Optional[Exception] = None, content_type: str = 'application/json', payload: Dict[KT, VT] = None, headers: Dict[KT, VT] = None, response_class: Optional[aiohttp.client_reqrep.ClientResponse] = None, repeat: bool = False, timeout: bool = False, reason: Optional[str] = None, callback: Optional[Callable] = None) → None[source]
clear()[source]
delete(url: Union[yarl.URL, str, re.Pattern], **kwargs)[source]
get(url: Union[yarl.URL, str, re.Pattern], **kwargs)[source]
head(url: Union[yarl.URL, str, re.Pattern], **kwargs)[source]
match(method: str, url: yarl.URL, **kwargs) → Optional[aiohttp.client_reqrep.ClientResponse][source]
options(url: Union[yarl.URL, str, re.Pattern], **kwargs)[source]
patch(url: Union[yarl.URL, str, re.Pattern], **kwargs)[source]
post(url: Union[yarl.URL, str, re.Pattern], **kwargs)[source]
put(url: Union[yarl.URL, str, re.Pattern], **kwargs)[source]
requests = None
start()[source]
stop() → None[source]

Module contents

class aioresponses.CallbackResult(method: str = 'GET', status: int = 200, body: str = '', content_type: str = 'application/json', payload: Dict[KT, VT] = None, headers: Dict[KT, VT] = None, response_class: Optional[aiohttp.client_reqrep.ClientResponse] = None, reason: Optional[str] = None)[source]

Bases: object

class aioresponses.aioresponses(**kwargs)[source]

Bases: object

Mock aiohttp requests made by ClientSession.

add(url: Union[yarl.URL, str, re.Pattern], method: str = 'GET', status: int = 200, body: str = '', exception: Optional[Exception] = None, content_type: str = 'application/json', payload: Dict[KT, VT] = None, headers: Dict[KT, VT] = None, response_class: Optional[aiohttp.client_reqrep.ClientResponse] = None, repeat: bool = False, timeout: bool = False, reason: Optional[str] = None, callback: Optional[Callable] = None) → None[source]
clear()[source]
delete(url: Union[yarl.URL, str, re.Pattern], **kwargs)[source]
get(url: Union[yarl.URL, str, re.Pattern], **kwargs)[source]
head(url: Union[yarl.URL, str, re.Pattern], **kwargs)[source]
match(method: str, url: yarl.URL, **kwargs) → Optional[aiohttp.client_reqrep.ClientResponse][source]
options(url: Union[yarl.URL, str, re.Pattern], **kwargs)[source]
patch(url: Union[yarl.URL, str, re.Pattern], **kwargs)[source]
post(url: Union[yarl.URL, str, re.Pattern], **kwargs)[source]
put(url: Union[yarl.URL, str, re.Pattern], **kwargs)[source]
requests = None
start()[source]
stop() → None[source]