我正在尝试使用 Requests-OAuthlib 对 OAuth1 进行身份验证,但它失败了。我正在从以下网站获得帮助:
https://requests-oauthlib.readthedocs.io...#oauth-1-0
>> client_key = 'xxxx'
>> client_secret = 'xxxx'
>> callback_uri = 'https://127.0.0.1/callback'
>> request_token_url='https://rest.immobilienscout24.de/restapi/security/oauth/request_token',
>> access_token_url='https://rest.immobilienscout24.de/restapi/security/oauth/access_token',
>> authorize_url='https://rest.immobilienscout24.de/restapi/security/oauth/confirm_access',
>> oauth_session = OAuth1Session(client_key,client_secret=client_secret, callback_uri=callback_uri)
>> oauth_session.fetch_request_token(request_token_url)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/desktop/Documents/anaconda/anaconda3/envs/py27/lib/python2.7/site-packages/requests_oauthlib/oauth1_session.py", line 287, in fetch_request_token
token = self._fetch_token(url, **request_kwargs)
File "/Users/desktop/Documents/anaconda/anaconda3/envs/py27/lib/python2.7/site-packages/requests_oauthlib/oauth1_session.py", line 365, in _fetch_token
r = self.post(url, **request_kwargs)
File "/Users/desktop/Documents/anaconda/anaconda3/envs/py27/lib/python2.7/site-packages/requests/sessions.py", line 578, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/Users/desktop/Documents/anaconda/anaconda3/envs/py27/lib/python2.7/site-packages/requests/sessions.py", line 516, in request
prep = self.prepare_request(req)
File "/Users/desktop/Documents/anaconda/anaconda3/envs/py27/lib/python2.7/site-packages/requests/sessions.py", line 459, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/Users/desktop/Documents/anaconda/anaconda3/envs/py27/lib/python2.7/site-packages/requests/models.py", line 318, in prepare
self.prepare_auth(auth, url)
File "/Users/desktop/Documents/anaconda/anaconda3/envs/py27/lib/python2.7/site-packages/requests/models.py", line 549, in prepare_auth
r = auth(self)
File "/Users/desktop/Documents/anaconda/anaconda3/envs/py27/lib/python2.7/site-packages/requests_oauthlib/oauth1_auth.py", line 109, in __call__
unicode(r.url), unicode(r.method), None, r.headers
File "/Users/desktop/Documents/anaconda/anaconda3/envs/py27/lib/python2.7/site-packages/oauthlib/oauth1/rfc5849/__init__.py", line 313, in sign
('oauth_signature', self.get_oauth_signature(request)))
File "/Users/desktop/Documents/anaconda/anaconda3/envs/py27/lib/python2.7/site-packages/oauthlib/oauth1/rfc5849/__init__.py", line 136, in get_oauth_signature
normalized_uri = signature.base_string_uri(uri, headers.get('Host', None))
File "/Users/desktop/Documents/anaconda/anaconda3/envs/py27/lib/python2.7/site-packages/oauthlib/oauth1/rfc5849/signature.py", line 144, in base_string_uri
raise ValueError('uri must include a scheme and netloc')
ValueError: uri must include a scheme and netloc
Anyhelp如何解决这个问题