コード例 #1
0
import random
from api2ch import Api

# create object api
dvach = Api()

# select section
dvach.board = "pr"

# fetch list of threads
threads = dvach.get_board()

# select random thread and fetch posts
for post in dvach.get_thread(random.choice(list(threads))):
    print post
コード例 #2
0
from api2ch import Api, Message

# create object api
dvach = Api()

# select section
dvach.board = 'pr'

# get settings (important)
dvach.get_settings()

# make message
post = Message(96266, "python api 3", "SAGE")

# fetch captcha
captcha = dvach.get_captcha()

# input decrypt captcha code
print captcha.url
cap = raw_input("enter captcha code: ")

# set decrypt captcha code
post.captcha = cap

# send post
dvach.send_post(post)