Giter Site home page Giter Site logo

wallhavenapi's Introduction

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

  • 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.

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_wallpaper - Download wallpaper to file (or get data) 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

WallhavenApiV1.collections - get collections by user name

  • user_name {String} - user name

WallhavenApiV1.collection_wallpapers - get wallpapers by user collection id

  • user_name {String} - user name
  • collection_id {Int} - user collection id (can obtained by WallhavenApiV1.collections)
  • page {Int} - page

WallhavenApiV1.my_collections - get collections of api_key user

It works only if api_key is set

wallhavenapi's People

Contributors

goblenus avatar resonance50 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.