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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file six21-0.1.3.tar.gz.

File metadata

  • Download URL: six21-0.1.3.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.11

File hashes

Hashes for six21-0.1.3.tar.gz
Algorithm Hash digest
SHA256 23c9c357ad87ec8714da4d24631529b85145ab06e33cd1da9eb17c1cff99135d
MD5 12a7b0f824f6da782073a2b165cd2eb7
BLAKE2b-256 8c735db486acfa08c63b86fa5a277c7fee833d15c3bb702b76c8a02915471d79

See more details on using hashes here.

File details

Details for the file six21-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: six21-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.11

File hashes

Hashes for six21-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6498163ab98dee81cb7ce60273e4db15ba707e1c915d3eb7d4e3c269fb8d41e6
MD5 ca8657a1fac0a9c052c037cad8333400
BLAKE2b-256 15e3859f2cb832d4ea4fe74fe159dac6afcb67db885ac9521189c7601f13ec2c

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