mirror of
https://github.com/searxng/searxng.git
synced 2026-07-31 04:11:26 +00:00
[mod] engines: replace [random.choice(...) for ... in range(..)] with random.choices
This commit is contained in:
@@ -82,7 +82,7 @@ fragment SXNG_query on Query {
|
||||
|
||||
def setup(_) -> bool:
|
||||
global SXNG_query # pylint: disable=global-statement
|
||||
rand_str: str = "".join(random.choice(string.ascii_letters) for _ in range(5))
|
||||
rand_str: str = "".join(random.choices(string.ascii_letters, k=5))
|
||||
SXNG_query = SXNG_query.replace("SXNG_query", "PhotoSearchPaginationContainer_query_1" + rand_str)
|
||||
return True
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ base_url = "https://api.bilibili.com/x/web-interface/search/type"
|
||||
|
||||
cookie = {
|
||||
"innersign": "0",
|
||||
"buvid3": "".join(random.choice(string.hexdigits) for _ in range(16)) + "infoc",
|
||||
"buvid3": "".join(random.choices(string.hexdigits, k=16)) + "infoc",
|
||||
"i-wanna-go-back": "-1",
|
||||
"b_ut": "7",
|
||||
"FEED_LIVE_VERSION": "V8",
|
||||
|
||||
@@ -92,7 +92,7 @@ def generate_nonce(length: int = 32) -> str:
|
||||
"""
|
||||
Generate a random char sequence with the given length.
|
||||
"""
|
||||
return "".join([random.choice(NONCE_ALPHABET) for _ in range(length)])
|
||||
return "".join(random.choices(NONCE_ALPHABET, k=length))
|
||||
|
||||
|
||||
def caesar_shift_with_switch_case(s: str, offset: int = 13) -> str:
|
||||
|
||||
Reference in New Issue
Block a user