summary refs log tree commit diff
path: root/protocol/data.py
diff options
context:
space:
mode:
Diffstat (limited to 'protocol/data.py')
-rw-r--r--protocol/data.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/protocol/data.py b/protocol/data.py
new file mode 100644
index 0000000..a732d14
--- /dev/null
+++ b/protocol/data.py
@@ -0,0 +1,9 @@
+from base64 import b64decode
+class DataProtocol():
+    def get(url):
+        mime = url.split(':')[1].split(',')[0].split(';')[0]
+        base64 = 'base64' in url.split(',')[0].split(';')
+        content = ','.join(url.split(',')[1:])
+        if base64:
+            content = b64decode(content)
+        return (mime or 'text/plain', [content])