开发者

How do I mock a urllib2 response when using a custom opener?

开发者 https://www.devze.com 2023-03-17 12:03 出处:网络
I\'m installing a custom urllib2 BaseHandler to deal with HTTP 304 responses (as per here), and this works fine. However, when testing my other methods, I u开发者_StackOverflowse the method from this

I'm installing a custom urllib2 BaseHandler to deal with HTTP 304 responses (as per here), and this works fine. However, when testing my other methods, I u开发者_StackOverflowse the method from this SO answer, which works perfectly. However, since the method from the first answer overrides the custom opener, I cant use it for testing. Is there an alternative approach?

0

精彩评论

暂无评论...
验证码 换一张
取 消