maykinmedia / ddt-api-calls Goto Github PK
View Code? Open in Web Editor NEWA Django Debug Toolbar pannel to track calls made with requests library
License: MIT License
A Django Debug Toolbar pannel to track calls made with requests library
License: MIT License
request.is_ajax
no longer exists
See also #4 -> with fetch
requests these request headers weren't set in the first place.
Ofcourse, the underlying issue is the connection but the debug panel should not error out if this is the case.
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.
A "Could not load node" error is shown when attempting to list CMS pages. Underwater, a AttributeError is raised:
'APICallsPanel' object has no attribute 'mocker'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.