[Bug 1471927] Re: AccessToken.from_string() crashes on python3

Brian Murray brian at ubuntu.com
Thu Jan 12 23:25:48 UTC 2017


Hello Zygmunt, or anyone else affected,

Accepted python-launchpadlib into xenial-proposed. The package will
build now and be available at https://launchpad.net/ubuntu/+source
/python-launchpadlib/1.10.3-3ubuntu0.1 in a few hours, and then in the
-proposed repository.

Please help us by testing this new package.  See
https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how
to enable and use -proposed.Your feedback will aid us getting this
update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug,
mentioning the version of the package you tested, and change the tag
from verification-needed to verification-done. If it does not fix the
bug for you, please add a comment stating that, and change the tag to
verification-failed.  In either case, details of your testing will help
us make a better decision.

Further information regarding the verification process can be found at
https://wiki.ubuntu.com/QATeam/PerformingSRUVerification .  Thank you in
advance!

** Changed in: python-launchpadlib (Ubuntu Xenial)
       Status: In Progress => Fix Committed

** Tags added: verification-needed

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python-launchpadlib in Ubuntu.
https://bugs.launchpad.net/bugs/1471927

Title:
  AccessToken.from_string() crashes on python3

Status in launchpadlib :
  Fix Committed
Status in python-launchpadlib package in Ubuntu:
  Fix Released
Status in python-launchpadlib source package in Xenial:
  Fix Committed

Bug description:
  [Impact]

   * Unable to renew/relogin with a new oauth token, using python3 scripts
   * python2 APIs work (because python2 does not care about str vs bytes)

  [Test Case]

   * Attempt login_with() using python3 and an expired/invalid existing token
   * Relogin should be successful, without crashing scripts

  [Regression Potential]

   * No change in behaviour on python2 (which is what used by reverse dependencies)
   * this is a backport to fix python3 behaviour, for all the newly ported maintainance scripts in python3 that prefer to run on "stable" systems

  [Other Info]
   
   * Well tested in later releases, and with users running from trunk.
   * I believe this still is not published in the cheeseshop.

  [Original bug report]

  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

To manage notifications about this bug go to:
https://bugs.launchpad.net/launchpadlib/+bug/1471927/+subscriptions



More information about the foundations-bugs mailing list