如何使用python向Linkedin职位搜索API发出GET请求

时间:2019-11-07 18:26:24

标签: linkedin linkedin-api

我能够按照Microsoft的文档进行身份验证过程。我获得了访问令牌,但是在查找有关如何使用访问令牌向Linkedin Job Search API发出GET请求的文档时遇到了麻烦。我想获得给出工作名称和工作状态的工作列表。

到目前为止,这是我的代码

from linkedin_v2 import linkedin
import requests
from requests_oauthlib import OAuth1

API_KEY = 'your own'
API_SECRET = 'your own'
return_url = 'http://localhost:8889/'
state='your own'
scope=['r_basicprofile', 'r_emailaddress','w_member_social']

authentication = linkedin.LinkedInAuthentication(API_KEY,API_SECRET,return_url,scope)

**Click on the url and logged in to my account and got the code
print(authentication.authorization_url)**

authentication.authorization_code = 'code you get after log in'
result = authentication.get_access_token()

**Prints the token I need**
print(result.access_token)
print(result.expires_in)

application = linkedin.LinkedInApplication(token='your own token')

**I tried this, but not sure if this is the correct way. Again cannot find documentation to     make get requests in Python.** 

r = requests.get('https://api.linkedin.com/v1/job-search?job-title=Software+Engineer')
print(r) ##Response 401

0 个答案:

没有答案