dipanjal / WallhavenApi

Wallhaven API for Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wallhaven API for Python

pipeline status Coverage Status codecov Scrutinizer Code Quality Dependency Status

Feel free to add an issue.

Description

Implementation of https://wallhaven.cc/help/api (the official one)

Dependencies

# pip install -r requirements.txt

Quick Documentation

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")

Methods

WallhavenApiV1.search - Accessing Wallpaper information

  • 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

WallhavenApiV1.is_walpaper_exists - Check wallpaper existence by id

  • wallpaper_id {String} - wallpaper id (can be obtained by WallhavenApiV1.search)

WallhavenApiV1.download_walpaper - Download wallpaper to file by id

  • wallpaper_id {String} - wallpaper id (WallhavenApiV1.search)
  • file_path {String} - path to file
  • chunk_size {Int} - chunked buffer for downloading

WallhavenApiV1.tag - Get tag information

  • tag_id {String} - tag id (can be obtained by WallhavenApiV1.search)

WallhavenApiV1.settings - Get user settings

It works only if api_key is set

About

Wallhaven API for Python


Languages

Language:Python 100.0%