私はあなたの呼び出しが失敗している理由はわかりません。ここでは、検証されたoauth2ライブラリをPythonで使用し、HTTPの会話全体を含むシーケンスを示します。プロファイル取得する http://api.linkedin.com/v1/people-search:(people:(distance,id,first-name,last-name,headline,api-standard-profile-request))
Parameters (I'm using OAuth in the parameters for this call)
oauth_body_hash=2jmj7l5rSw0yVb%2FvlWAYkK%2FYBwk%3D
oauth_nonce=41358038
oauth_timestamp=1330098205
oauth_consumer_key=xxx
oauth_signature_method=HMAC-SHA1
facet=network%2CO
oauth_version=1.0
oauth_token=xxx
keywords=Schneider+Electric
oauth_signature=xxx
Response includes:
<person>
<distance>-1</distance>
<id>UBAQYFeiHo</id>
<first-name></first-name>
<last-name>Private</last-name>
<headline>Assistant Engineer at Schneider Electric</headline>
<api-standard-profile-request>
<url>http://api.linkedin.com/v1/people/UBAQYFeiHo</url>
<headers total="1">
<http-header>
<name>x-li-auth-token</name>
<value>OUT_OF_NETWORK:wHti</value>
</http-header>
</headers>
</api-standard-profile-request>
</person>
第二コール、::
まず、検索を行う http://api.linkedin.com/v1/people/UBAQYFeiHo:(id,first-name,last-name)を
Request headers:
Host: api.linkedin.com
x-li-auth-token: OUT_OF_NETWORK:wHti
accept-encoding: gzip, deflate
user-agent: Python-httplib2/$Rev$
Response:
{'status': '200', 'content-length': '158', 'content-location': u'http://api.linkedin.com/v1/people/UBAQYFeiHo:(id,first-name,last-name)?oauth_body_hash=2jmj7l5rSw0yVb%2FvlWAYkK%2FYBwk%3D&oauth_nonce=27886786&oauth_timestamp=1330098212&oauth_consumer_key=xxx&oauth_signature_method=HMAC-SHA1&oauth_version=1.0&oauth_token=xxx&oauth_signature=xxx', 'transfer-encoding': 'chunked', 'vary': '*', 'server': 'Apache-Coyote/1.1', '-content-encoding': 'gzip', 'date': 'Fri, 24 Feb 2012 15:43:34 GMT', 'x-li-request-id': 'N368G241EA', 'x-li-format': 'xml', 'content-type': 'text/xml;charset=UTF-8'}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<person>
<id>UBAQYFeiHo</id>
<first-name></first-name>
<last-name>Private</last-name>
</person>
と第2パートの仕事を作るためのPythonコードoauth2ライブラリは
import oauth2 as oauth
import time
url = "http://api.linkedin.com/v1/people/UBAQYFeiHo:(id,first-name,last-name)"
consumer = oauth.Consumer(
key="xxx",
secret="xxx")
token = oauth.Token(
key="xxx",
secret="xxx")
client = oauth.Client(consumer, token)
resp, content = client.request(url, headers={'x-li-auth-token':'OUT_OF_NETWORK:wHti'})
print resp
print content
ありがとうあなたもう一度キルステン:) – joulesm
誰もがPython Oauth2ライブラリを使用! APIコールはシンプルで使いやすく理解しやすいです。 – joulesm