Skip to content

Latest commit

 

History

History
179 lines (109 loc) · 4.75 KB

API.md

File metadata and controls

179 lines (109 loc) · 4.75 KB

API Reference

This page outlines the API wrapper of cbmc.py

API Instances

Post Object


API Instances

SyncCbmc

class SyncCbmc(CbmcBase)

PARAMETERS:

  • None

get_post(params) ⇒ [Post]

Get a post from 麥塊匿名發文平台 with the given parameters.

Param Type Description
post_id int The post ID of the post you want to get.

Example

api.get_post(post_id=1)

# or

SyncCbmc.get_post(post_id=1) # directly call the method also works if you don't need to use the instance

get_posts(params) ⇒ [List[Post]]

Get a list of posts from 麥塊匿名發文平台 with the given parameters.

Param Type Default Description
limit int 10 The number of the posts you want to get. (Max: 300)

Example

api.get_posts(limit=10)

# or

SyncCbmc.get_posts(limit=10) # directly call the method also works if you don't need to use the instance

get_status(params) ⇒ [dict]

Get the status of a post on 麥塊匿名發文平台.
This method is NOT implemented yet.

Param Type Description
code str The code of the post you want to get the status.

Example

api.get_status(code="123456")

# or

SyncCbmc.get_status(code="123456") # directly call the method also works if you don't need to use the instance

AsyncCbmc

class AsyncCbmc(CbmcBase)

PARAMETERS:

  • None

await get_post(params) ⇒ [Post]

Get a post from 麥塊匿名發文平台 with the given parameters.

Param Type Description
post_id int The post ID of the post you want to get.

Example

await api.get_post(post_id=1)

# or

await AsyncCbmc.get_post(post_id=1) # directly call the method also works if you don't need to use the instance

await get_posts(params) ⇒ [List[Post]]

Get a list of posts from 麥塊匿名發文平台 with the given parameters.

Param Type Default Description
limit int 10 The number of the posts you want to get. (Max: 300)

Example

await api.get_posts(limit=10)

# or

await AsyncCbmc.get_posts(limit=10) # directly call the method also works if you don't need to use the instance

await get_status(params) ⇒ [dict]

Get the status of a post on 麥塊匿名發文平台. This method is NOT implemented yet.

Param Type Description
code str The code of the post you want to get the status.

Example

await api.get_status(code="123456")

# or

await AsyncCbmc.get_status(code="123456") # directly call the method also works if you don't need to use the instance

Post Object

Post

class Post(data)

PARAMETERS:

ATTRIBUTES:

  • post_id: [int] - The post ID of the post.
  • platform_id: [int] - The platform ID of the post.
  • type: [str] - The post type of the post.
  • content: [str] - The content of the post.
  • photo: [str | None] - The photo url of the post or None if there is no photo.
  • admin_post: [bool] - Whether the post is an admin post.
  • approve_timestamp: [int] - The timestamp of when the post was approved.
  • approve_time: [datetime.datetime] - The time of when the post was approved.
  • approve_user: [str] - The user who approved the post.
  • fbid: [str] - The Facebook ID of the post.

to_dict() ⇒ [dict]

Convert the post object to a dictionary.

Example

post.to_dict()