summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2017-12-22 17:04:39 +0100
committerLars-Dominik Braun <lars@6xq.net>2017-12-22 17:04:39 +0100
commitbcfbdd9b45b7e872ee77e1366197443d855d8c7c (patch)
tree965672a5c9a054ad6f290773e41cef02496420ca
parent936ad8ccea07d5f99d606bf07168f8ba5bb49c62 (diff)
downloadcrocoite-bcfbdd9b45b7e872ee77e1366197443d855d8c7c.zip
crocoite-bcfbdd9b45b7e872ee77e1366197443d855d8c7c.tar.gz
crocoite-bcfbdd9b45b7e872ee77e1366197443d855d8c7c.tar.bz2
SiteLoader: Save entire finished response
-rw-r--r--crocoite/browser.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/crocoite/browser.py b/crocoite/browser.py
index 3e0e310..e7eb4e2 100644
--- a/crocoite/browser.py
+++ b/crocoite/browser.py
@@ -33,7 +33,7 @@ class Item:
def __init__ (self):
self.chromeRequest = None
self.chromeResponse = None
- self.encodedDataLength = 0
+ self.chromeFinished = None
def __repr__ (self):
return '<Item {}>'.format (self.request['url'])
@@ -54,12 +54,19 @@ class Item:
def id (self):
return self.chromeRequest['requestId']
+ @property
+ def encodedDataLength (self):
+ return self.chromeFinished['encodedDataLength']
+
def setRequest (self, req):
self.chromeRequest = req
def setResponse (self, resp):
self.chromeResponse = resp
+ def setFinished (self, finished):
+ self.chromeFinished = finished
+
class SiteLoader:
"""
Load site in Chrome and monitor network requests
@@ -199,7 +206,7 @@ class SiteLoader:
url = urlsplit (resp['url'])
if url.scheme in self.allowedSchemes:
self.logger.info ('finished {} {}'.format (reqId, req['url']))
- item.encodedDataLength = kwargs['encodedDataLength']
+ item.setFinished (kwargs)
self.loadingFinished (item)
def _loadingFailed (self, **kwargs):