post

PyPtt.API.post(self, board: str, title_index: int, title: str, content: str, sign_file: [str | int] = 0) None

發文。

參數:
  • board (str) – 看板名稱。

  • title_index (int) – 文章標題編號。

  • title (str) – 文章標題。

  • content (str) – 文章內容。

  • sign_file (str | int) – 編號或隨機簽名檔 (x),預設為 0 (不選)。

回傳:

None

引發:

範例:

import PyPtt

ptt_bot = PyPtt.API()
try:
    # .. login ..
    ptt_bot.post(board='Test', title_index=1, title='PyPtt 程式貼文測試', content='測試內容', sign_file=0)
    # .. do something ..
finally:
    ptt_bot.logout()