py8chan.File – 8chan File¶
py8chan.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
py8chan.File(post, data)[source]¶ Represents File objects and their thumbnails.
- Constructor:
- post (py8chan.Post) - parent Post object. data (dict) - The post or extra_files dict from the 8chan API.
-
file_md5¶ MD5 hash of the file attached to this post.
Type: string
-
file_md5_hex¶ Hex-encoded MD5 hash of the file attached to this post.
Type: string
-
filename_original¶ Original name of the file attached to this post.
Type: string
-
filename¶ Filename 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
-
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
py8chan.Fileobject with an attribute likepy8chan.Post.first_file.