Ejemplo n.º 1
0
def patch_on_http_response(default_http_client: DefaultHTTPClient,
                           abort_on=[]):
    def patched(self, resource, response):
        self.last_response = response
        return (response.status_code not in abort_on)

    default_http_client.on_http_response = types.MethodType(
        patched, default_http_client)
Ejemplo n.º 2
0
def patch_on_http_response(default_http_client: DefaultHTTPClient,
                           abort_on=[]):
    def patched(self, method: str, url: str, response: Response, **kwargs):
        self.last_response = response
        return (response.status_code not in abort_on)

    default_http_client.on_http_response = types.MethodType(
        patched, default_http_client)