Closed wpietri closed 3 years ago
Might be a good topic for a blog post if you have a blog.
Right now I don't have any plans to expand on the set of examples in the docs and there are much more important topics which still aren't even covered in the docs, such as all the APIs to support monkey patching.
So I'll close this issue out for now, but if I ever get back to expanding on examples in the docs I will be trolling back through issues to identify common use cases that keep coming up, so maybe will revisit this example then. Thanks.
I need to wrap the client for a third-party API so I can record all the calls we make and the return values. The API has a lot of methods, so I wanted a way to wrap every call. This took me a while to figure out.
Most of the ObjectProxy examples wrap a function. I've put below an example of it wrapping an object, which hopefully will help people like me who are not as familiar with Python's internals. Feel free to edit as you like. Also glad to submit a pull request if you let me know where you'd like it.