Giter Site home page Giter Site logo

ddt-api-calls's People

Contributors

joeribekker avatar sergei-maertens avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ddt-api-calls's Issues

Broken on Django 4.2

request.is_ajax no longer exists

See also #4 -> with fetch requests these request headers weren't set in the first place.

`PreparedRequest` object has no attribute `timing`

On some rare occasions, the _fake_send method fails to add timing to the request, resulting in an AttributeError when generating stats.

This happens randomly, and from what I could experience, it is happening when two requests are made at the same time:

I've added two debug prints to have the following function:

def _fake_send(session, request, **kwargs):
    ...
    req = next(r for r in self.request_history if r._request == request)
    print(f"Got req: {id(req)}")
    
    try:
        response = _original_send(session, request, **kwargs)
    except Exception:
        response = None
        raise
    else:
        req.status_code = response.status_code
    finally:
        duration = (
            response.elapsed.total_seconds() if response is not None else 0
        )
        end = start + duration  # approximate
        req.timing = (start, end, int(duration * 1000))
    print(f"Added timing: {id(req)}")
    return response    

And this is the output that I have:

Got req: 139792829185104
Got req: 139792830198480
Added timing: 139792830198480
Added timing: 139792829185104

It seems to be failing if two requests are made almost at the same time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.