0
我正在嘗試關注一些通過Python代碼在LinkedIn上註冊的公司,並按照LinkedIn API documentation我需要使用oauth2 - POST方法來關注公司。Python - oauth2 - linkedin API
我的查詢低於:
- 如何通過Python代碼指定要遵循公司的一個公司的名稱?
- 有人可以建議這個python代碼嗎?
我的代碼如下:
oauth_token = oauth.Token(key=access_token_key, secret=access_token_secret)
oauth_consumer = oauth.Consumer(key=api_key, secret=api_secret)
signature_method_hmac_sha1 = oauth.SignatureMethod_HMAC_SHA1()
http_method = "POST"
http_handler = urllib.HTTPHandler(debuglevel=_debug)
https_handler = urllib.HTTPSHandler(debuglevel=_debug)
def linkedinreq(url, method, parameters):
req = oauth.Request.from_consumer_and_token(oauth_consumer,
token=oauth_token,
http_method=http_method,
http_url=url,
parameters=parameters)
req.sign_request(signature_method_hmac_sha1, oauth_consumer, oauth_token)
req.to_postdata()
def fetchsamples():
url = "https://api.linkedin.com/v1/people/~/following/companies"
parameters = []
response = linkedinreq(url, "POST", parameters)
fetchsamples()
感謝您的答覆。我遇到了這個鏈接並使用它。但是,我想知道關於oauth2中的POST。我無法找到理解這一點的好教程。 – Chandra 2014-09-01 01:54:36