feat: Add cache encryption #9
@ -1,7 +1,7 @@
|
||||
# import notifier
|
||||
from clicada.cli.notify import NotifyWriter
|
||||
notifier = NotifyWriter()
|
||||
notifier.notify('loading script')
|
||||
#notifier.notify('loading script')
|
||||
|
||||
# standard imports
|
||||
import os
|
||||
|
@ -3,6 +3,7 @@ import hashlib
|
||||
import urllib.parse
|
||||
import os
|
||||
import logging
|
||||
from socket import getservbyname
|
||||
|
||||
# external imports
|
||||
from usumbufu.client.base import (
|
||||
@ -48,7 +49,15 @@ class HTTPSession:
|
||||
def __init__(self, url, auth=None, origin=None):
|
||||
self.base_url = url
|
||||
url_parts = urllib.parse.urlsplit(self.base_url)
|
||||
url_parts_origin = (url_parts[0], url_parts[1], '', '', '',)
|
||||
url_parts_origin_host = url_parts[1].split(":")
|
||||
host = url_parts_origin_host[0]
|
||||
try:
|
||||
host = host + ':' + url_parts_origin_host[1]
|
||||
except IndexError:
|
||||
host = host + ':' + str(getservbyname(url_parts[0]))
|
||||
logg.info('changed origin with missing port number from {} to {}'.format(url_parts[1], host))
|
||||
url_parts_origin = (url_parts[0], host, '', '', '',)
|
||||
|
||||
self.origin = origin
|
||||
if self.origin == None:
|
||||
self.origin = urllib.parse.urlunsplit(url_parts_origin)
|
||||
|
@ -1,12 +1,13 @@
|
||||
# standard imports
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
|
||||
class NotifyWriter:
|
||||
|
||||
def __init__(self, writer=sys.stdout):
|
||||
(c, r) = os.get_terminal_size()
|
||||
(c, r) = shutil.get_terminal_size()
|
||||
self.cols = c
|
||||
self.fmt = "\r{:" + "<{}".format(c) + "}"
|
||||
self.w = writer
|
||||
|
Loading…
Reference in New Issue
Block a user