I have a Python function, fetch_data, that goes and hits a remote API, grabs some data, and returns it wrapped in a response object. It looks a bit like the below:
def fetch_data(self, foo, bar, baz, **kwargs):
response = Response()
# Do various things, get some data
return response
Now, it's possible that the response data says "I have more data, call me with an incremented page parameter to get more". Thus, I'd essentially like to store "The Method Call" (function, parameters) in the response object, so I can then have a Response.get_more() which looks at the stored function and parameters, and calls the function again with (almost) the same parameters, returning a new Response
Now if fetch_data were defined as fetch_data(*args, **kwargs) I could just store (fetch_data, args, kwargs) in response. However I have self, foo, bar and baz to worry about - I could just store (fetch_data, foo, bar, baz, kwargs) but that's a highly undesirable amount of repetition.
Essentially, I'm trying to work out how to, from within a function, get a completely populated *args and **kwargs, including the function's named parameters.