requests-mock
requests-mock copied to clipboard
Suggest to replace _Context to Context in requests_mock.response.
I want to know the reason the class is hidden (requests_mock.response._Context)
It makes typing hard in situation like below
def callback(request: requests.Request, context: requests_mock.response._Context)
This code needs to break encapsulation for typing..
So I suggest that, please give me feedbacks for this
It's hidden because it's something that exposes a public interface but that a user should never have to instantiate directly. It was easier to make that private rather than commit to an interface at the time.
If there's a good reason to make it public (like this appears to be) I'm open to it, though I might tweak the class name and at least make it public from the root package.
Probably call it CallbackContext to be more explicit?
Note also that #94 is an issue to actually provide type hints for requests-mock if you have some ideas how that should work i'll happily work with you on that.
It will need to use the external formats though as we need to support python2.7 for a while yet.