mirror of https://github.com/searx/searx
fix code
This commit is contained in:
parent
9a76493685
commit
2f09ad202a
|
@ -23,6 +23,7 @@ categories = ['music']
|
|||
paging = True
|
||||
api_client_id = None
|
||||
api_client_secret = None
|
||||
timeout = 10.0
|
||||
|
||||
# search-url
|
||||
url = 'https://api.spotify.com/'
|
||||
|
@ -40,9 +41,10 @@ def request(query, params):
|
|||
|
||||
r = requests.post(
|
||||
'https://accounts.spotify.com/api/token',
|
||||
timeout=timeout,
|
||||
data={'grant_type': 'client_credentials'},
|
||||
headers={'Authorization': 'Basic ' + base64.b64encode(
|
||||
"{}:{}".format(api_client_id, api_client_secret).encode()
|
||||
"{}:{}".format(api_client_id, api_client_secret).encode(),
|
||||
).decode()}
|
||||
)
|
||||
j = loads(r.text)
|
||||
|
|
|
@ -30,7 +30,7 @@ HTTP_COLON = 'http:'
|
|||
|
||||
|
||||
def get_bang_url():
|
||||
response = requests.get(URL_BV1)
|
||||
response = requests.get(URL_BV1, timeout=10.0)
|
||||
response.raise_for_status()
|
||||
|
||||
r = RE_BANG_VERSION.findall(response.text)
|
||||
|
@ -38,7 +38,7 @@ def get_bang_url():
|
|||
|
||||
|
||||
def fetch_ddg_bangs(url):
|
||||
response = requests.get(url)
|
||||
response = requests.get(url, timeout=10.0)
|
||||
response.raise_for_status()
|
||||
return json.loads(response.content.decode())
|
||||
|
||||
|
|
Loading…
Reference in New Issue