Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python中的linkedin:无法发送多条消息_Python_Linkedin - Fatal编程技术网

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

python中的linkedin:无法发送多条消息,python,linkedin,Python,Linkedin,我想使用python向linkedin中的多个朋友发送消息。 来自文档: 使用这个可以发送那个 result = api.SendMessage("This is a subject", "This is the body", ["ID1", "ID2", "ID3"]) 但我不能使用它。有人能告诉我ID1是什么吗?ID2?等等?它们是您希望向其发送消息的人的ID。不要使用['ID1'、'ID2'、'ID3'],而是尝试使用send_your=True来确保您所做的工作正常。因此,它将是: r

我想使用python向linkedin中的多个朋友发送消息。
来自文档:
使用这个可以发送那个

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

但我不能使用它。有人能告诉我ID1是什么吗?ID2?等等?

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

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

您只能发送一级连接消息。因此,为了获得有效的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])
>>connections=api.Getconnections()#connections是配置文件实例的列表
>>>联系
>>> []
>>>连接[0]。id
>>>“js6vz2-D6x”
>>>result=api.SendMessage(“这是一个主题”,“这是正文”,“连接[0].id,连接[1].id,连接[2].id])

是的,我可以发送给自己。我已经做完了。但我无法向人们的ID发送消息。请举例说明哪些ID?您只能发送一级连接消息。我粘贴了一些代码作为答案,因为我找不到一个好的方法将其格式化为注释。你说的一级连接是什么意思?好的,我理解一级连接的意思。但是,如果我只能通过api向一级连接发送消息,那么它有什么用呢?LinkedIn网站就是这样工作的。这类似于你只能在Twitter上发送DM关注者。这意味着你不能发送连接列表中未连接的消息?