py8chan.Thread – 8chan Threads

py8chan.Thread allows for standard access to a 8chan thread, including listing all the posts in the thread, information such as whether the thread is locked and stickied, and lists of attached file URLs or thumbnails.

Basic Usage

class py8chan.Thread(board, id)[source]

Represents a thread.

closed

Whether the thread has been closed.

Type:bool
sticky

Whether this thread is a ‘sticky’.

Type:bool
topic

Topic post of the thread, the OP.

Type:py8chan.Post
posts

List of all posts in the thread, including the OP.

Type:list of py8chan.Post
all_posts

List of all posts in the thread, including the OP and any omitted posts.

Type:list of py8chan.Post
url

URL of the thread, not including semantic slug.

Type:string
Undefined Attributes
Type:Not implemented in 8chan API. Do not use.
replies and images

Infuriatingly, the OP post in a thread

doesn't list how many replies there are in a thread.
semantic_url

URL of this post, with the thread’s ‘semantic’ component.

Type:string
semantic_slug

This post’s ‘semantic slug’.

Type:string

Methods

Thread objects are not instantiated directly, but instead through the appropriate py8chan.Board methods such as py8chan.Board.get_thread().

Thread.files()[source]

Returns the URLs of all files attached to posts in the thread.

Thread.thumbs()[source]

Returns the URLs of all thumbnails in the thread.

Thread.filenames()[source]

Returns the filenames of all files attached to posts in the thread.

Thread.thumbnames()[source]

Returns the filenames of all thumbnails in the thread.

Thread.update(force=False)[source]

Fetch new posts from the server.

Parameters:force (bool) – Force a thread update, even if thread has 404’d.
Returns:How many new posts have been fetched.
Return type:int
Thread.expand()[source]

If there are omitted posts, update to include all posts.