mirror of
https://github.com/searxng/searxng.git
synced 2025-07-13 16:29:17 +02:00
fix hmac python3 compatibility
This commit is contained in:
parent
9804ab7a1b
commit
e73cb14889
2 changed files with 13 additions and 3 deletions
|
@ -1,4 +1,6 @@
|
|||
import csv
|
||||
import hashlib
|
||||
import hmac
|
||||
import os
|
||||
import re
|
||||
|
||||
|
@ -321,3 +323,10 @@ def load_module(filename, module_dir):
|
|||
module = load_source(modname, filepath)
|
||||
module.name = modname
|
||||
return module
|
||||
|
||||
|
||||
def new_hmac(secret_key, url):
|
||||
if sys.version_info[0] == 2:
|
||||
return hmac.new(bytes(secret_key), url, hashlib.sha256).hexdigest()
|
||||
else:
|
||||
return hmac.new(bytes(secret_key, 'utf-8'), url, hashlib.sha256).hexdigest()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue