summaryrefslogtreecommitdiff
path: root/crocoite/util.py
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2019-07-02 09:14:55 +0200
committerLars-Dominik Braun <lars@6xq.net>2019-07-02 09:16:55 +0200
commit9ff793e96139ed40090ab9d8c3cae99b284858e5 (patch)
treee1b568fc77c0600a767fea1f541de1d5e85d87a5 /crocoite/util.py
parent9d8d48358bf44d7a3e4918bcdac3f4ef1348541b (diff)
downloadcrocoite-9ff793e96139ed40090ab9d8c3cae99b284858e5.tar.gz
crocoite-9ff793e96139ed40090ab9d8c3cae99b284858e5.tar.bz2
crocoite-9ff793e96139ed40090ab9d8c3cae99b284858e5.zip
Stabilize WARC headers
In preparation for 1.0 release: - Correct mime types - Add X-Crocoite-Type, so logs, scripts, dom-snapshots and screenshots can be identified easily - Remove random WARC headers like X-Chrome-Initiator. We don’t want to maintain those. - Remove non-standard urn-based package URLs. Can’t use them without a urn-registration
Diffstat (limited to 'crocoite/util.py')
-rw-r--r--crocoite/util.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/crocoite/util.py b/crocoite/util.py
index ded5e99..da377a3 100644
--- a/crocoite/util.py
+++ b/crocoite/util.py
@@ -26,6 +26,8 @@ import random, sys, platform, os, json, urllib
from datetime import datetime
import hashlib, pkg_resources
+from yarl import URL
+
class StrJsonEncoder (json.JSONEncoder):
""" JSON encoder that turns unknown classes into a string and thus never
fails """
@@ -39,12 +41,6 @@ class StrJsonEncoder (json.JSONEncoder):
except TypeError:
return str (obj)
-def packageUrl (path):
- """
- Create URL for package data stored into WARC
- """
- return 'urn:' + __package__ + ':' + urllib.parse.quote (path)
-
async def getFormattedViewportMetrics (tab):
layoutMetrics = await tab.Page.getLayoutMetrics ()
# XXX: I’m not entirely sure which one we should use here