Skip to content
Advertisement

Tag: request

Python Requests: Hook or no Hook?

I ‘.get’ a request and process the response like: After reading the package’s docs, I saw that there is a hook functionality which would permit me to do: My questions: When should I use hooks? Or, why should I use hooks? I wish to initiate an object (a parser) after a request’s response is returned using the requests resp.text procedure.

How can I mock requests and the response?

I am trying to use Pythons mock package to mock Pythons requests module. What are the basic calls to get me working in below scenario? In my views.py, I have a function that makes variety of requests.get() calls with different response each time In my test class I want to do something like this but cannot figure out exact method

Advertisement