Skip to main content

An simple python package for e621

Project description

six21

A python api wrapper for e621.net

Features

  • Getting Recent Posts From e6
  • Searching For Posts
  • Getting Random Posts
  • Getting An Post By Its Id

Usage

To use you need to have requests and json packages installed

First, import into your project

from six21 import e621

If needed set User to the name of your project

e621.Set_User("NAME_OF_PROJECT")

Searching will return a list of posts that fit the criteria that the tags provide
Usage:

e621.search(tags, page, limit)
  • tags Is what keywords you want to search for are and should be given in a list
  • page is what page you want to go to during the search and should be given in a int
  • limit is the limit to how many posts you want to retrieve

Getting recent posts will return a list of posts that have been most recently posted to e6
Usage:

e621.recent(limit)
  • limit is the limit to how many posts you want to retrieve

Returns one random post from e6
Usage

e621.random()

Returns the post from the given Id
Usage:

e621.get_post(Id)
  • Id is the Id of the post you want it to return

Post Object

id: The ID number of the post.
created_at: The time the post was created in the format of YYYY-MM-DDTHH:MM:SS.MS+00:00.
updated_at: The time the post was last updated in the format of YYYY-MM-DDTHH:MM:SS.MS+00:00.

file (subclass)

width: The width of the post.
height: The height of the post.
ext: The file’s extension.
size: The size of the file in bytes.
md5: The md5 of the file.
url: The URL where the file is hosted on E6

preview (subclass)

width: The width of the post preview.
height: The height of the post preview.
url: The URL where the preview file is hosted on E6

sample (subclass)

has: If the post has a sample/thumbnail or not. (True/False)
width: The width of the post sample.
height: The height of the post sample.
url: The URL where the sample file is hosted on E6.

score (subclass)

up: The number of times voted up.
down: A negative number representing the number of times voted down.
total: The total score (up + down).

tags (subclass)

general: A list of all the general tags on the post.
species: A list of all the species tags on the post.
character: A list of all the character tags on the post.
artist: A list of all the artist tags on the post.
invalid: A list of all the invalid tags on the post.
lore: A list of all the lore tags on the post.
meta: A list of all the meta tags on the post.

locked_tags: A JSON array of tags that are locked on the post.
change_seq: An ID that increases for every post alteration on E6 (explained below)
flags (subclass)

pending: If the post is pending approval. (True/False)
flagged: If the post is flagged for deletion. (True/False)
note_locked: If the post has it’s notes locked. (True/False)
status_locked: If the post’s status has been locked. (True/False)
rating_locked: If the post’s rating has been locked. (True/False)
deleted: If the post has been deleted. (True/False)

rating: The post’s rating. Either s, q or e.
fav_count: How many people have favorited the post.
sources: The source field of the post.
pools: An array of Pool IDs that the post is a part of.
relationships (subclass)

parent_id: The ID of the post’s parent, if it has one.
has_children: If the post has child posts (True/False)
has_active_children: children A list of child post IDs that are linked to the post, if it has any.

approver_id: The ID of the user that approved the post, if available.
uploader_id: The ID of the user that uploaded the post.
description: The post’s description.
comment_count: The count of comments on the post.

Usage Example

Below is a script that will grab a random post then print the post id, allong with the raw file url:

from six21 import e621 #Import Package

random_post = e621.random() #Get a random post

post_id = random_post.id #From the post get its Id

post_file_url = random_post.file.url #From the post get its Url

print("Post Id: {Id} \nFile Url: {Url}".format(Id = post_id,Url = post_file_url )) #Print Id and Url

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

six21-0.1.3.tar.gz (4.9 kB view hashes)

Uploaded Source

Built Distribution

six21-0.1.3-py3-none-any.whl (4.9 kB view hashes)

Uploaded Python 3

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