Comment 0 for bug 1471927

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Trying to use Launchpad.login_with() on python3, after fixing the earlier bug yields this issue:

Traceback (most recent call last):
  File "./foo.py", line 31, in <module>
    lb = launchpad.projects[project]
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py", line 1001, in __getitem__
    shim_resource._ensure_representation()
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py", line 382, in _ensure_representation
    representation = self._root._browser.get(self._wadl_resource)
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 436, in get
    response, content = self._request(url, extra_headers=headers)
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 387, in _request
    str(url), method=method, body=data, headers=headers)
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 357, in _request_and_retry
    url, method=method, body=body, headers=headers)
  File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 1291, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
  File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", line 132, in _request
    return self.retry_on_bad_token(response, content, *args)
  File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", line 144, in retry_on_bad_token
    self.launchpad.credentials, self.launchpad.credential_store)
  File "/usr/lib/python3/dist-packages/launchpadlib/credentials.py", line 545, in __call__
    self.make_end_user_authorize_token(credentials, request_token_string)
  File "/usr/lib/python3/dist-packages/launchpadlib/credentials.py", line 658, in make_end_user_authorize_token
    self.web_root)
  File "/usr/lib/python3/dist-packages/launchpadlib/credentials.py", line 233, in exchange_request_token_for_access_token
    self.access_token = AccessToken.from_string(content)
  File "/usr/lib/python3/dist-packages/launchpadlib/credentials.py", line 251, in from_string
    key = params['oauth_token']
KeyError: 'oauth_token'

The problem is that params has b'oauth_token', not 'oauth_token', which matters on python3