url = https://api.linkedin.com/v1/people/~:(id,public-profile-url,three-current-positions)?oauth2_access_token=linkedin_access_token
import requests
response = requests.get(url)
以下摘录自回复内容
<position>
<id>581851303</id>
<start-date>
<year>2014</year>
<month>9</month>
</start-date>
<is-current>true</is-current>
<company>
</company>
但是在浏览器中打开时,相同的url会提供以下输出
<position>
<id>581851303</id>
<title>UPV grant</title>
<summary>Historical building colour research Restoration research</summary>
<start-date>
<year>2013</year>
<month>9</month>
</start-date>
<is-current>true</is-current>
<company>
<name>Departamento de Expresión Gráfica UPV</name>
</company>
</position>
请参阅python响应中缺少标题,摘要和公司名称。
我尝试应用用户代理标头,如
header = {'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:32.0)
Gecko/20100101 Firefox/32.0',} in requests.get(url,headers=header)
但没有改善
知道如何在python代码中获取类似浏览器的内容吗?