没有在Feed中显示LinkedIn图片上传“状态”:“ CLIENT_ERROR”

问题描述

我目前在上传图片并将其发布到LinkedIn Feed时遇到了一些麻烦。 当我将图像上传到从 / v2 / assets?action = registerUpload 端点收到的上传网址时,收到201响应。但是,当我随后发布到LinkedIn(具有图像为URN的富媒体帖子)时,即使我从 / v2 / shares 端点获得了201,也没有在我的Feed显示任何帖子。

我认为将图片上传到给定的上传网址的方式存在问题,因为当我使用 / v2 / assets / [URN] 查询上传的资产时会收到此响应:

Image of response

这是到目前为止我尝试上传内容

# Upload the image
headers = {
    "Authorization": f"Bearer {token}","Content-Type": "application/binary"
}

with open("virtualbadge.png","rb") as file:
   r = requests.put(upload_url,files={"file": open("myImage.png","rb")},headers=headers)

共享:

# Share post
headers = {
    "Authorization": f"Bearer {token}","Content-Type": "application/json"
}
payload = {
   "content": {
      "contentEntities": [
        {
           "entity": image_urn,}
      ],"title": "My Post Title","shareMediaCategory": "RICH","description": "My Description",},"distribution": {
      "linkedindistributionTarget": {}
   },"subject": "My Subject","text": {
      text": "My Text","owner": f"urn:li:person:{user_id}",}

share_post = requests.post("https://api.linkedin.com/v2/shares",data=json.dumps(payload),headers=headers)

任何帮助将不胜感激!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)