Browse Source

Fix usage of `api_key` engine setting

The value of `params['api_key']` isn't read anywhere.
Writing directly into the header object solves this quite easily though.

> [Users can authenticate by including their API key either in a request URL by appending `?apikey=<API KEY>`, or by including the `X-API-Key: <API KEY>` header with the request.](https://wallhaven.cc/help/api)
Lucki 3 months ago
parent
commit
18c3e08837
1 changed files with 1 additions and 1 deletions
  1. 1 1
      searx/engines/wallhaven.py

+ 1 - 1
searx/engines/wallhaven.py

@@ -57,7 +57,7 @@ def request(query, params):
     }
 
     if api_key:
-        params['api_key'] = api_key
+        params['headers']['X-API-Key'] = api_key
 
     params['url'] = f"{base_url}/api/v1/search?{urlencode(args)}"
     return params