I ' .get ' the request and process the response like:
resp = requests.get('url') resp = resp.text .. # do stuff with resp
After reading the package documents, I saw that there is a hook function that would allow me to do:
def process_r(resp, **kwargs): .. do stuff with resp resp = requests.get('url', hooks = {'response': process_r})
My questions:
When should I use hooks? Or why should I use hooks?
I want to initiate an object (parser) after responding to a request using the resp.text request resp.text .
What is Pythonic, the right approach here for this scenario?
thanks
source share