title: Getting all arguments and values passed to a function
body: <p>I have a Python function, <code>fetch_data</code>, 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:</p>
  
  <pre><code>def fetch_data(self, foo, bar, baz, **kwargs):
      response = Response()
      # Do various things, get some data
      return response
  </code></pre>
  
  <p>Now, it's possible that the response data says "I have more data, call me with an incremented <code>page</code> 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 <code>Response.get_more()</code> which looks at the stored function and parameters, and calls the function again with (almost) the same parameters, returning a new <code>Response</code></p>
  
  <p>Now if <code>fetch_data</code> were defined as <code>fetch_data(*args, **kwargs)</code> I could just store <code>(fetch_data, args, kwargs)</code> in <code>response</code>. However I have <code>self</code>, <code>foo</code>, <code>bar</code> and <code>baz</code> to worry about - I could just store <code>(fetch_data, foo, bar, baz, kwargs)</code> but that's a highly undesirable amount of repetition.</p>
  
  <p>Essentially, I'm trying to work out how to, from within a function, get a completely populated <code>*args</code> and <code>**kwargs</code>, including the function's named parameters.</p>