【发布时间】:2019-12-31 02:01:53
【问题描述】:
只是想用 python 发送一条 Facebook 消息。
代码:
import fbchat
from fbchat import Client
from fbchat.models import *
client = Client("my_username", "my_password")
#help(fb.Client.send)
#client.send(text="This is a test", thread_id="christopher.batey", thread_type=ThreadType.USER)
name = "christopher.batey"
friends = client.searchForUsers(name)
friend = friends[0]
uid = friend.uid
msg = "This is a test"
print(help(client.send))
client.send(Message(text=msg, thread_id="christopher.batey", thread_type=ThreadType.USER))
错误:
Traceback(最近一次通话最后一次):
文件“main.py”,第 13 行,在
client.send(Message(text=msg, thread_id="christopher.batey", thread_type=ThreadType.USER))TypeError: init() 得到了一个意外的关键字参数 'thread_id'
【问题讨论】:
-
Facebook 的服务条款规定您需要使用 API 与他们进行交互。 fbchat 库未使用 API。
标签: python python-3.x facebook