Skip to content

Instantly share code, notes, and snippets.

@FeryET
Last active April 29, 2020 12:37
Show Gist options
  • Save FeryET/ce0e0b023af3e479c53299524b5d9d4b to your computer and use it in GitHub Desktop.
Save FeryET/ce0e0b023af3e479c53299524b5d9d4b to your computer and use it in GitHub Desktop.
def foo(func, *args, **kwargs):
res = func(*args, **kwargs)
return res["a key"]["in json"]["response"]
class A:
def __init__(self, api):
super().__init__()
self.api = api
def get_x(self):
res = self.api.get_x()
return res["a key"]["in json"]["response"]
def get_y(self):
res = self.api.get_y()
return res["a key"]["in json"]["response"]
@foo(self.api.get_x)
def my_desired_get(self):
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment