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)
This commit is contained in:
Lucki 2025-01-05 21:54:04 +01:00 committed by Markus Heiser
parent 96c32549be
commit 18c3e08837

View file

@ -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