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
¶ 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
¶ Name of the file attached to this post.
Type: string
-
filename_original
¶ 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
basc_py4chan.File
object with an attribute likebasc_py4chan.Post.first_file
.-