HTTPretty icon indicating copy to clipboard operation
HTTPretty copied to clipboard

Support for asyncio/gevent/etc

Open BenjamenMeyer opened this issue 10 years ago • 5 comments

It would be great if there was support for monkey patching Python3's asyncio, gevent, and other similar libs as these are becoming more popular. Python3's asyncio should be doable if socketpair was also monkey patched.

BenjamenMeyer avatar Feb 19 '15 23:02 BenjamenMeyer

Per #254, it seems like this might only be a problem with HTTPS, at least with eventlet/gevent. We use HTTPretty through moto, and once we started connecting with is_secure=False, we were able to use gevent + HTTPretty.

rouge8 avatar Aug 03 '15 17:08 rouge8

Glad you found a solution for gevent, however, asyncio/aiohttp is a different issue. There just isn't any really any project that does to asyncio/aiohttp project what httypretty does to standard sockets.

BenjamenMeyer avatar Sep 12 '15 02:09 BenjamenMeyer

FWIW, I started my own variant targetted at Python3 and asyncio/aiohttp - https://github.com/TestInABox/aiohttp-mock - still working out some of the details, but the interface should be generally compatible, and help is welcomed.

Note: Updated the URL b/c I moved the projects into their own org.

BenjamenMeyer avatar Dec 10 '15 19:12 BenjamenMeyer

Mocket supports both gevent and asyncio/aiohttp. https://pypi.python.org/pypi/mocket/2.0.0

mindflayer avatar Aug 27 '17 20:08 mindflayer

@mindflayer thanks for the info on that; I'll take a look at it for another project (https://pypi.python.org/pypi/stackinabox) which provides built-in suport for HTTpretty among others.

BenjamenMeyer avatar Sep 05 '17 22:09 BenjamenMeyer