molotov icon indicating copy to clipboard operation
molotov copied to clipboard

Add scenario in info dict of every molotov events

Open douardda opened this issue 7 years ago • 4 comments

When writing a molotov event handler (like in example6.py), it would make life easier to have a reference to the scenario in sending_request or response_received events (as it is done for scenario_xxx events).

douardda avatar Jan 25 '18 09:01 douardda

That would be cool indeed. It requires two things:

  • add in ~~LoggedClientSession~~ LoggedClientRequest a scenario property that can be changed
  • when the scenario is called, set the property in https://github.com/loads/molotov/blob/master/molotov/worker.py#L172

would you like to takle it ? :)

tarekziade avatar Jan 25 '18 10:01 tarekziade

I'm currently digging it, yes

douardda avatar Jan 25 '18 10:01 douardda

Notice that since we are in async mode, the scenario value should be linked to the request object, not the session, because the session deals with many requests in parallel

tarekziade avatar Jan 25 '18 10:01 tarekziade

I've seen that, and that makes life a bit harder since the request object is instanciated deep inside the ClientSession._request coroutine...

douardda avatar Jan 25 '18 10:01 douardda