Skip to main content

A comprehensive, realiable API client for weheartit.

Project description

weheartpy

A fast, reliable API client for WeHeartIt.

weheartit

Description

weheartpy is an unofficial API client for weheartit

WeHeartIt does not have an API. So I have to make use of BeautifulSoup and requests to do my job. The speed is optimal, it has a limitation on number of results you can retreive through one search but its functional.

Requirements

  • requires Python 10.4 or above.
  • read the requirements here

you can easily install the packages using pip

Installation

pip install weheartpy

or

pip install git+https://github.com/aswinnnn/weheartit.git

Features

with weheartpy, you can search for:

  • posts aka entries
  • collections (including images inside them)
  • users
  • popular entries

I'm adding more functionalities and utilities later on, but this is all we got for now.

Usage

this is the most basic usage of the weheartpy module.

# import the main class
from weheartpy import WeHeartIt

whi = WeHeartIt() # create an instance of WeHeartIt

entries = whi.popular() # returns a list of recent popular images from homepage.

for entry in entries:
	print(entry.id)
	print(entry.username)
	print(entry.image)
	print(entry.url)
  • parameters - None

  • returns - List[Entry] a list of Entry objects which help you access the entries easier.

  • errors - ConnectionError

Posts / Entries

search for entries.

entries = whi.search_entries("mean girls", sort="most_popular")
# returns a list of entries relevant to your query.

for entry in entries:
	print(entry.username, entry.image, entry.url)
  • parameters - query - your search query

  • returns - List[Entry] a list of Entry objects which help you access the entries easier.

  • errors - ConnectionError

Collections

# return a list of `Collection` objects resulting from the query.

from weheartpy import WeHeartIt

whi = WeHeartIt()

cocs = whi.search_collections("anime pfp")
for c in cocs:
    print(c.title, c.link)
    collection = c.get_full_collection()
    print(collection.images, collection.description)
  • parameters - query aka the search term
  • returns - List[Collection] Check out the documentation to see what else you can do with Collection objects.
  • errors - NoCollectionsFound

Documentation

  • check out the documentation for more usages.
  • If you'd like to add something or fix mistakes, feel free to open an issue or a pull request.

About

  • more utilities might come later, depending on need and interest.
  • feel free to fork, pull, and open issues!
  • currently on v0.2

Disclaimer

  • Since this makeshift API client relies on the websites elements to remain unchanged, expect this package to break easily someday. useragent will be supported soon.
  • This package, code or software is made for educational purposes and does not intend to break any ToS of weheartit.com. The creator/maintainer of this package will not be responsible for any actions done using the code. Use with your own caution and volition.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

weheartpy-0.2.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

weheartpy-0.2.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file weheartpy-0.2.0.tar.gz.

File metadata

  • Download URL: weheartpy-0.2.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for weheartpy-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9b4efdeebcbd4b226e2b4ce440d9cb59a48f602cf80fd7bc89df4e535ea0bfac
MD5 248a874a209f9b4a244e1bf258c12650
BLAKE2b-256 9c7946b8c1b4415cdeb2aca5560d445de16a2a00a8f165a69a9b809bc064d663

See more details on using hashes here.

File details

Details for the file weheartpy-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: weheartpy-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for weheartpy-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 544fb8c73de1c2c04ffc1cc0b3c1efe86cce170105d7094039749ec8853c38fa
MD5 a4802a809375c56eb65baa818a79d0d5
BLAKE2b-256 5192b4a2aeb9ba90b3eede7668987aaa7b83d28b187fe6abe15ebda3c231c74f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page