

Feel free to add an issue.
Implementation of https://wallhaven.cc/help/api (the official one)
# pip install -r requirements.txt
Import WallhavenApi package:
import wallhavenapi
Initialize WallhavenApi:
wallhaven_api= wallhavenapi.WallhavenApiV1()
If you have an account on Wallhaven, you can use api key to access all available wallpapers:
wallhaven_api = wallhavenapi.WallhavenApiV1(api_key="some_api_key")
- api_key {String} – your Wallhaven api key
- verify_connection {Bool} – check ssl cert
- base_url {String} – Wallhaven base api url
- timeout {Tuple(Int, Int)} – http request timeout
- requestslimit_timeout {Tuple(Int, Int)} – try to handle 429 http error. The first Int – how many times to do request, the second – delay (in seconds) between requests.
- q {String} – query (used to filter by user, tags, ids and so on…)
- categories {String|List[String]} – walpaper category (located in wallhavenapi.Category)
- purities {String|List[String]} – walpaper purity (located in wallhavenapi.Purity)
- sorting {String} – how to sort results (located in wallhavenapi.Sorting)
- order {String} – sort order (located in wallhavenapi.Order)
- top_range {String} – sorting MUST be set to ‘toplist’ (located in wallhavenapi.TopRange)
- atleast {Typle(Int,Int)} – minimum resolution
- resolutions {Typle(Int,Int)|List[Typle(Int,Int)]} – exact wallpaper resolutions
- ratios {Typle(Int,Int)|List[Typle(Int,Int)]} – aspect ratios
- colors {String} – color to search (located in wallhavenapi.Color)
- page {Int} – page for pagination
- wallpaper_id {String} – wallpaper id (can be obtained by WallhavenApiV1.search)
- wallpaper_id {String} – wallpaper id (WallhavenApiV1.search)
- file_path {String} – path to file
- chunk_size {Int} – chunked buffer for downloading
- tag_id {String} – tag id (can be obtained by WallhavenApiV1.search)
It works only if api_key is set
- user_name {String} – user name
- user_name {String} – user name
- collection_id {Int} – user collection id (can obtained by
WallhavenApiV1.collections
) - page {Int} – page
It works only if api_key is set

Leave a Reply