Add logging to custom requests.
This commit is contained in:
parent
daa3808b7f
commit
29c84f4f20
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
"""Handler functions for different qute:... pages."""
|
"""Handler functions for different qute:... pages."""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from qutebrowser.network.schemehandler import (SchemeHandler,
|
from qutebrowser.network.schemehandler import (SchemeHandler,
|
||||||
SpecialNetworkReply)
|
SpecialNetworkReply)
|
||||||
from qutebrowser.utils.version import version
|
from qutebrowser.utils.version import version
|
||||||
@ -104,6 +106,7 @@ class QuteSchemeHandler(SchemeHandler):
|
|||||||
# FIXME handle unknown pages
|
# FIXME handle unknown pages
|
||||||
# FIXME adjust URLutils based on handlers
|
# FIXME adjust URLutils based on handlers
|
||||||
|
|
||||||
|
logging.debug('request: {}'.format(request))
|
||||||
data = handle(urlstring(request.url()))
|
data = handle(urlstring(request.url()))
|
||||||
return SpecialNetworkReply(request, data, "text/html", self.parent())
|
return SpecialNetworkReply(request, data, "text/html", self.parent())
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
"""Base class for custom scheme handlers."""
|
"""Base class for custom scheme handlers."""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from PyQt5.QtNetwork import QNetworkReply, QNetworkRequest
|
from PyQt5.QtNetwork import QNetworkReply, QNetworkRequest
|
||||||
from PyQt5.QtCore import pyqtSlot, QObject, QIODevice, QByteArray
|
from PyQt5.QtCore import pyqtSlot, QObject, QIODevice, QByteArray
|
||||||
|
|
||||||
@ -96,6 +98,7 @@ class SpecialNetworkReply(QNetworkReply):
|
|||||||
if self._data.length() == 0:
|
if self._data.length() == 0:
|
||||||
self.finished.emit()
|
self.finished.emit()
|
||||||
return self._data.length() + super().bytesAvailable()
|
return self._data.length() + super().bytesAvailable()
|
||||||
|
logging.debug("bytes available: {}".format(len(self._data)))
|
||||||
|
|
||||||
def readData(self, maxlen):
|
def readData(self, maxlen):
|
||||||
"""Retrieve data from the reply object.
|
"""Retrieve data from the reply object.
|
||||||
@ -115,4 +118,5 @@ class SpecialNetworkReply(QNetworkReply):
|
|||||||
self._data.remove(0, len_)
|
self._data.remove(0, len_)
|
||||||
if self._data.length() == 0:
|
if self._data.length() == 0:
|
||||||
self.finished.emit()
|
self.finished.emit()
|
||||||
|
logging.debug("readdata, len {}, maxlen {}, buf {}".format(len(self._data), maxlen, buf))
|
||||||
return buf
|
return buf
|
||||||
|
Loading…
Reference in New Issue
Block a user