在领英中,所有者实体类型为个人的账号是不支持的。以下是使用Python代码示例来判断给定账号的所有者实体类型是否为个人:
import requests
def get_owner_entity_type(access_token):
url = 'https://api.linkedin.com/v2/me'
headers = {
'Authorization': f'Bearer {access_token}',
'cache-control': 'no-cache',
'X-Restli-Protocol-Version': '2.0.0'
}
response = requests.get(url, headers=headers)
data = response.json()
entity_type = data.get('entityType')
return entity_type
# 使用示例
access_token = 'YOUR_ACCESS_TOKEN'
entity_type = get_owner_entity_type(access_token)
if entity_type == 'PERSON':
print("该账号的所有者实体类型为个人。")
else:
print("该账号的所有者实体类型不是个人。")
请确保替换YOUR_ACCESS_TOKEN
为有效的领英访问令牌。该代码将通过访问领英的API来获取账号的所有者实体类型,并判断其是否为个人。
上一篇:不支持连接文件格式