Convert result_proxy.key into bytearray if necessary
This commit is contained in:
parent
7bf4e8d12d
commit
e59b9a1932
@ -325,7 +325,10 @@ def proxify(url: str):
|
|||||||
url_params = dict(mortyurl=url)
|
url_params = dict(mortyurl=url)
|
||||||
|
|
||||||
if settings['result_proxy'].get('key'):
|
if settings['result_proxy'].get('key'):
|
||||||
url_params['mortyhash'] = hmac.new(settings['result_proxy']['key'], url.encode(), hashlib.sha256).hexdigest()
|
key = settings['result_proxy']['key']
|
||||||
|
if isinstance(key, str):
|
||||||
|
key = bytearray(key.encode())
|
||||||
|
url_params['mortyhash'] = hmac.new(key, url.encode(), hashlib.sha256).hexdigest()
|
||||||
|
|
||||||
return '{0}?{1}'.format(settings['result_proxy']['url'], urlencode(url_params))
|
return '{0}?{1}'.format(settings['result_proxy']['url'], urlencode(url_params))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user