来自python的linkedin:无法发送多条消息

时间:2011-06-16 17:17:49

标签: python linkedin

我想使用python向linkedin中的多个朋友发送消息 来自docs:http://code.google.com/p/python-linkedin/
使用这个可以发送它。

result = api.SendMessage("This is a subject", "This is the body", ["ID1", "ID2", "ID3"])

但我无法使用它。任何人都可以告诉我什么是ID1? ID2?等?

2 个答案:

答案 0 :(得分:2)

您只能向第一级连接发送消息。因此,为了获得有效的ID,我猜测代码看起来像:

>>> connections = api.Getconnections() # connections is a list of Profile instances
>>> connections
>>> [<linkedin.linkedin.Profile object at 0x1a3d510>]
>>> connections[0].id
>>> 'js6vz2-D6x'
>>> result = api.SendMessage("This is a subject", "This is the body", [connections[0].id, connections[1].id, connections[2].id])

答案 1 :(得分:1)

它们是您希望向其发送消息的人的ID。而不是['ID1', 'ID2', 'ID3'],请尝试使用send_yourself = True来确保您正在做的工作。所以它将是:

result = api.SendMessage("This is a subject", "This is the body", send_yourself = True)