This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://bugs.python.org/issue33342 | |
# from six.moves.urllib import parse as urllib_parse | |
from urllib.parse import urlparse | |
def parsefn(url): | |
# return urllib_parse.urlparse(url) | |
return urlparse(url) | |
def try_parse(url): | |
uri_parts = parsefn(url) | |
print(f"\tURI Parts={uri_parts}") | |
if uri_parts.fragment: | |
print("\t\t***FAILED PARSE - fragment should be empty***") | |
if uri_parts.query != 'sslmode=required': | |
print("\t\t***FAILED PARSE - actual query parm not parsed***") | |
def make_url(password): | |
url = f'postgresql://kara_admin:{password}@hifi-kara-db-dev.do.aws/kara?sslmode=required' | |
return url | |
passwords = """ | |
bob | |
vLrnXUW1.DQ+3ya#=p}7gy{KS+3d | |
vLrnXUW1.DQ+3ya?=p}7gy{KS+3d | |
vLrnXUW1.DQ+3ya=p}7gy{KS+3d | |
""".split() | |
for password in passwords: | |
print(f"------------------------\nPassword={password}") | |
url = make_url(password) | |
try_parse(url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
metaperl commentedJan 23, 2019