gabrielfalcao / HTTPretty

Intercept HTTP requests at the Python socket level. Fakes the whole socket module

Home Page:https://httpretty.readthedocs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Document global allow_net_connect flag

thigg opened this issue · comments

commented

I haven't found any place in the documentation where it is mentioned, that it is possible to globally disable network access:

HTTPretty.allow_net_connect = False

I also didn't find a good place to add it, thus I am leaving this issue here.

From a quick look I'm not sure it's generally a good idea to set allow_net_connect directly - but rather should be set via HTTPretty.enable(allow_net_connect=False). Calling it this way monkeypatches some of python's socket implementation with a fake socket.

So I guess probably better not to add documentation to show that, as it would potentially encourage bad practice and potentially more buggy usage.