Skip to content

safe mode doesn't work when not returning response #639

piotr-dobrogost opened this Issue May 28, 2012 · 3 comments

5 participants

from requests import get

if __name__ == '__main__':

    invalid_url = 'http://_/'
    req = get(invalid_url,
    res = req.send() # throws ConnectionError

The reason is catch_exceptions_if_in_safe_mode() decorates request() which calls Session.request() which does not call Request.send() when send_request is False which is the case with async requests. I guess we should decorate Request.send() not request()

See issue #583

@piotr-dobrogost piotr-dobrogost referenced this issue in kennethreitz/grequests May 28, 2012

safe mode doesn't work for async requests #6


We will also have to change the catch_exceptions_if_in_safe_mode decorator a bit, so that it can decorate a method rather than a function, but that shouldn't be difficult.

@piotr-dobrogost piotr-dobrogost pushed a commit to piotr-dobrogost/requests that referenced this issue Jun 12, 2012
Piotr Dobrogost Fixes safe mode when not sending requests immediately (issue #639) 52f3344
locojay commented Aug 2, 2012

+1 for this @piotr-dobrogost requests fork fixes exceptions when using grequest


an obsolete request since safe_mode is removed in 1.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.