flanker
flanker copied to clipboard
TypeError: cannot use a string pattern on a bytes-like object
Python version 3.7.7 flanker version 0.9.11
from flanker.addresslib import address
address.validate_address(<custom domaian email address>)
----> 1 address.validate_address('custom domaian email address')
~/.virtualenvs/newvenv/lib/python3.7/site-packages/flanker/utils.py in wrapper(*args, **kwargs)
62 @wraps(f)
63 def wrapper(*args, **kwargs):
---> 64 return_value = f(*args, **kwargs)
65 if 'metrics' in kwargs and kwargs['metrics'] == True:
66 #return all values
~/.virtualenvs/newvenv/lib/python3.7/site-packages/flanker/addresslib/address.py in validate_address(addr_spec, metrics, skip_remote_checks)
321 # lookup custom local-part grammar if it exists
322 bstart = time()
--> 323 plugin = plugin_for_esp(exchanger)
324 mtimes['custom_grammar'] = time() - bstart
325 if plugin and plugin.validate(paddr) is False:
~/.virtualenvs/newvenv/lib/python3.7/site-packages/flanker/addresslib/validate.py in plugin_for_esp(mail_exchanger)
127 """
128 for grammar in _CUSTOM_GRAMMAR_LIST:
--> 129 if grammar[0].match(mail_exchanger):
130 return grammar[1]
131
TypeError: cannot use a string pattern on a bytes-like object
I found the fix flanker/flanker/addresslib/address.py line 322
from
plugin = plugin_for_esp(exchanger)
to
plugin = plugin_for_esp(exchanger.decode('utf-8'))
I'm having the same problem on Python 3.6. I'm surprised no one has commented on this ticket created back in June.
Any updates on this issue? Anything preventing the review of the pull request?
Any updates on this issue? Anything preventing the review of the pull request?
Feels like a dead project to me.
Hey guys! This has actually been fixed, but the pypi package isn't up to date. Anyone know who we should contact?
https://github.com/mailgun/flanker/pull/245/files
skip_remote_checks = True is a workaround ... as long as you guys don't need more stringent validation for production. I'd like to have it, so I'm awaiting.