starting to roll in some logging. still need to figure out what's going on with that gpg verifyData

This commit is contained in:
2019-12-17 03:40:08 -05:00
parent 1ae519bb40
commit f25e6bee2a
13 changed files with 670 additions and 122 deletions

29
aif/utils/parser.py Normal file
View File

@@ -0,0 +1,29 @@
import logging
import re
_logger = logging.getLogger('utils:{0}'.format(__name__))
_uri_re = re.compile((r'^(?P<scheme>[\w]+)://'
r'(?:(?P<user>[^:@]+)(?::(?P<password>[^@]+)?)?@)?'
r'(?P<base>[^/:]+)?'
r'(?::(?P<port>[0-9]+))?'
r'(?P<path>/.*)$'),
re.IGNORECASE)
class URI(object):
def __init__(self, uri):
self.orig_uri = uri
r = _uri_re.search(self.orig_uri)
if not r:
raise ValueError('Not a valid URI')
for k, v in dict(zip(list(_uri_re.groupindex.keys()), r.groups())).items():
setattr(self, k, v)
if self.port:
self.port = int(self.port)
for a in ('base', 'scheme'):
v = getattr(self, a)
if v:
setattr(self, a, v.lower())