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

Add whitelist feature #303 #448

Open dapicester opened 3 years ago

dapicester commented 3 years ago

Allow a whitelist of addresses to access the network. Pass a list of tuples (host, port) as whitelist argument.

whitelist = [
  ('localhost', 1234),
  ('127.0.0.1', 8080),
]
httpretty.enable(allow_net_connect=False, whitelist=whitelist)
# ...
leikoilja commented 1 year ago

@gabrielfalcao, can we merge this one?

leikoilja commented 1 year ago

@gabrielfalcao? :) i see you liked the commend above, but can we merge it? 😅

t-pohl commented 1 year ago

@gabrielfalcao Can this be merged now? would really help me if this would be available.

dapicester commented 1 year ago

Waiting for this to be merged, you can directly use my fork with pip or poetry.

leikoilja commented 1 year ago

Waiting for this to be merged, you can directly use my fork with pip or poetry.

@dapicester, which fork are you talking about? https://github.com/dapicester/HTTPretty is 3 commits behind httpretty original source and does not have whitelisting functionality merged 🤔

dapicester commented 1 year ago

@leikoilja you should use the feature/whitelist branch, not main.