def _inject_api_requests_methods(cls):
"""
requests.api is a module consisting of all the HTTP request types, defined as methods. If we're being called
with one of these types, then execute the call against the running server.
"""
for name in dir(requests.api):
if not name.startswith('_'):
func = getattr(requests.api, name)
if isinstance(func, types.FunctionType) and func.__module__ == requests.api.__name__:
setattr(cls, name, functools.partialmethod(cls._make_call, func))
评论列表
文章目录