Skip to main content

e621.net API wrapper written in Python

Project description

e621

e621 is a feature-rich high-level e621 and e926 API wrapper.

It provides access to almost all of the endpoints available. The only exceptions are unstable and admin-only endpoints.

e621 API documentation is currently highly undocumented, unstable, and sometimes even untruthful. We tried to wrap it in a sanest possible way, properly documenting all the possible ways to interact with it. However, if you still have any questions, bugs to report, or features to request -- please, create an issue on our github page and we will reply as soon as we can.

Installation

$ pip install e621

Quickstart

We translate everything the API returns to python data types created with pydantic. Everything is 100% typehinted so you get autocomplete everywhere and your IDE will warn you if you are sending invalid arguments or using nonexistent attributes.

Creating the api client

  • To create the most basic client, all you need to do is
from e621 import E621

api = E621()
  • If you wish to get information about your account, use your blacklist or create/update/delete any of the e621's entities, you will have to create an api key and put it into the API client as such:
api = E621(("your_e621_login", "your_e621_api_key"))

Searching

The majority of the endpoints allow you to query for a list of their entities, be it posts, pools or tags.

  • To search for posts that match the "canine" but not the "3d" tag:
posts = api.posts.search("canine -3d")
# Or
posts = api.posts.search(["canine", "-3d"])
  • To search for pools whose names start with "hello" and end with "kitty":
posts = api.pools.search(name_matches="hello*kitty")
  • e621 searching api is paginated, which means that if you want to get a lot of posts, you will have to make multiple requests with a different "page" parameter. To simplify interactions with paginated queries, all of our searching endpoints support the "limit", "page", and "ignore_pagination" parameters. If you wish to get a specific number of entities, simply pass the "limit" and "ignore_pagination" arguments:
tags = api.tags.search(name_matches="large_*", limit=900, ignore_pagination=True)

Getting

Many entities that have unique identifiers (such as post_id or username) support indexing using these ids:

post = api.posts.get(3291457)
posts = api.posts.get([3291457, 3069995])
pool = api.pools.get(28232)
user = api.users.get("fox")

Updating

api.posts.update(3291457, tag_string_diff="canine -male", description="Rick roll?")

Creating

from pathlib import Path

api.posts.create(
    tag_string="canine 3d rick_roll",
    file=Path("path/to/rickroll.webm"),
    rating="s",
    sources=[],
    description="Rick roll?"
)

FAQ

  • For more information on these and other api endpoints, please, visit our endpoint reference

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

e621-temp-0.0.6.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

e621_temp-0.0.6-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file e621-temp-0.0.6.tar.gz.

File metadata

  • Download URL: e621-temp-0.0.6.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.4 Linux/5.10.109-1-MANJARO

File hashes

Hashes for e621-temp-0.0.6.tar.gz
Algorithm Hash digest
SHA256 fedc0b9f31f29c4c5aebe24fd39f3060fad8ebb30e6ca2f51205551e4f8fa7d9
MD5 2736eb83752f89515b9818dc790301eb
BLAKE2b-256 ef4bf044bc106027986c1d8c966ef94cbab029bfe18379e2f5acea5a69694947

See more details on using hashes here.

File details

Details for the file e621_temp-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: e621_temp-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.4 Linux/5.10.109-1-MANJARO

File hashes

Hashes for e621_temp-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 81150e711c70b4893b6bfb4343da5e3ada874f7b8fd4dbcd48963b5e2da3b0e3
MD5 d9ffe32bf67e8534878ffd22bb9659e9
BLAKE2b-256 3335cb6e13f46fb16468e635ea3b3f1ec20497397666a19f62fa8e134be2fa70

See more details on using hashes here.

Supported by

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