class MyClass(object):
def __getattr__(self, method):
return Request(method)
def __call__(self, **kwargs):
for key, name in kwargs.items():
print(key, name)
class Request(object):
def __init__(self, method):
self.method = method
def __call__(self, **kwargs):
for key, name in kwargs.items():
print(key, name)
print('Method:', self.method)
m = MyClass()
m.foo(arg1='a', arg2='b')
Y2xhc3MgTXlDbGFzcyhvYmplY3QpOgoKICAgIGRlZiBfX2dldGF0dHJfXyhzZWxmLCBtZXRob2QpOgogICAgICAgIHJldHVybiBSZXF1ZXN0KG1ldGhvZCkKCiAgICBkZWYgX19jYWxsX18oc2VsZiwgKiprd2FyZ3MpOgogICAgICAgIGZvciBrZXksIG5hbWUgaW4ga3dhcmdzLml0ZW1zKCk6CiAgICAgICAgICAgIHByaW50KGtleSwgbmFtZSkKCgpjbGFzcyBSZXF1ZXN0KG9iamVjdCk6CgogICAgZGVmIF9faW5pdF9fKHNlbGYsIG1ldGhvZCk6CiAgICAgICAgc2VsZi5tZXRob2QgPSBtZXRob2QKCiAgICBkZWYgX19jYWxsX18oc2VsZiwgKiprd2FyZ3MpOgogICAgICAgIGZvciBrZXksIG5hbWUgaW4ga3dhcmdzLml0ZW1zKCk6CiAgICAgICAgICAgIHByaW50KGtleSwgbmFtZSkKICAgICAgICBwcmludCgnTWV0aG9kOicsIHNlbGYubWV0aG9kKQoKbSA9IE15Q2xhc3MoKQptLmZvbyhhcmcxPSdhJywgYXJnMj0nYicp