question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

the event request_success should pass request and response to the listener

See original GitHub issue

Is your feature request related to a problem? Please describe.

I want to fetch the headers of request or response when a request is successful.

Describe the solution you’d like

@events.request_success.add_listener
def my_success_handler(request_type, name, response_time, response_length, request, response, **kw):
    print("Successfully made a request to: %s" % name)

Describe alternatives you’ve considered

Additional context

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
tobeczmcommented, Jun 8, 2020

That wouldn’t work when using Locust to load test non-HTTP stuff. I’d recommend to either create a custom client, or wrap the client calls instead.

At least, we could put them into the optional arguments:

@events.request_success.add_listener
def my_success_handler(request_type, name, response_time, response_length, **kw):
    if 'request' in kw: 
        print('request:', kw['request'])
    if 'response' in kw: 
        print('response:', kw['response'])
    print("Successfully made a request to: %s" % name)
1reaction
cyberwcommented, Mar 5, 2021

I like the idea and will happily merge it, but someone else needs to write the code and some test cases 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Event hooks — Locust 2.14.0 documentation
The request event has a context parameter that enable you to pass data about the request (things like username, tags etc). It can...
Read more >
Using a Request Object Event Listener - AWS Documentation
To process the response, you must create an event listener for the AWS.Request object to register a callback function for the method call....
Read more >
Events and Event Listeners (Symfony Docs)
Creating an Event Subscriber; Request Events, Checking Types; Listeners or Subscribers ... App\EventListener; use Symfony\Component\HttpFoundation\Response; ...
Read more >
Event hooks - Okta Developer
After registering an event hook, but before you can use it, you need to have Okta make a one-time GET verification request to...
Read more >
Events - Laravel - The PHP Framework For Web Artisans
This command will generate any events or listeners that are listed in your ... efficient for the framework to scan all of your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found