gabrielfalcao / HTTPretty

Intercept HTTP requests at the Python socket level. Fakes the whole socket module
https://httpretty.readthedocs.org
MIT License
2.11k stars 276 forks source link

Document global allow_net_connect flag #461

Open thigg opened 2 years ago

thigg commented 2 years ago

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.

jamesL92 commented 1 year ago

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.