py420chan.File – 420chan File

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

Basic Usage

class py420chan.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.
filename

Original name of the file attached to this post.

Type:string
file_url

URL of the file attached to this post.

Type:string
file_extension

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

Type:string
file_size

Size of the file attached to this post.

Type:int
file_width

Width of the file attached to this post.

Type:int
file_height

Height of the file attached to this post.

Type:int
file_deleted

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

Type:bool
thumbnail_width

Width of the thumbnail attached to this post.

Type:int
thumbnail_height

Height of the thumbnail attached to this post.

Type:int
thumbnail_fname

Filename of the thumbnail attached to this post.

Type:string
thumbnail_url

URL of the thumbnail attached to this post.

Type:string

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