basc_py4chan.File – 4chan File

basc_py4chan.Post allows for standard access to a 4chan file. This provides programs with a complete File object that contains all metadata about the 4chan file, and makes migration easy if 4chan ever makes multiple files in one Post possible (as 8chan does).

Basic Usage

class basc_py4chan.File(post, data)[source]

Represents File objects and their thumbnails.

Constructor:
post (py4chan.Post) - parent Post object. data (dict) - The post or extra_files dict from the 8chan API.
file_md5

string – MD5 hash of the file attached to this post.

file_md5_hex

string – Hex-encoded MD5 hash of the file attached to this post.

filename

string – Name of the file attached to this post.

filename_original

string – Original name of the file attached to this post.

file_url

string – URL of the file attached to this post.

file_extension

string – Extension of the file attached to this post. Eg: png, webm, etc.

file_size

int – Size of the file attached to this post.

file_width

int – Width of the file attached to this post.

file_height

int – Height of the file attached to this post.

file_deleted

bool – Whether the file attached to this post was deleted after being posted.

thumbnail_width

int – Width of the thumbnail attached to this post.

thumbnail_height

int – Height of the thumbnail attached to this post.

thumbnail_fname

string – Filename of the thumbnail attached to this post.

thumbnail_url

string – URL of the thumbnail attached to this post.

File objects are not instantiated directly, but through a basc_py4chan.File object with an attribute like basc_py4chan.Post.first_file.