从Python发送LinkedIn消息:无法发送多个消息
我想用Python给LinkedIn上的多个朋友发送消息。
根据文档:http://code.google.com/p/python-linkedin/
使用这个可以发送消息。
result = api.SendMessage("This is a subject", "This is the body", ["ID1", "ID2", "ID3"])
但是我不知道怎么用。有没有人能告诉我,ID1、ID2这些是什么?
2 个回答
1
这些是你想要发送消息的人的ID。与其使用 ['ID1', 'ID2', 'ID3']
,不如试试用 send_yourself = True
来确保你所做的事情是有效的。这样就可以了:
result = api.SendMessage("This is a subject", "This is the body", send_yourself = True)
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])