python3-launchpadlib credentials.py broken for new auth creds
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
launchpadlib |
New
|
Undecided
|
Unassigned |
Bug Description
The authorization page:
(https:/
should be opening in your browser. Use your browser to authorize
this program to access Launchpad on your behalf.
Waiting to hear from Launchpad about your decision...
Created new window in existing browser session.
Traceback (most recent call last):
File "./bug", line 94, in <module>
exit(
File "./bug", line 61, in main
lp = s.lp
File "./bug", line 52, in lp
s._lp = Launchpad(
File "./bug", line 34, in __init__
version=
File "/usr/lib/
credential_
File "/usr/lib/
credentials = authorization_
File "/usr/lib/
self.
File "/usr/lib/
self.web_root)
File "/usr/lib/
self.
File "/usr/lib/
key = params[
KeyError: 'oauth_token'
I worked around the problem with the following horrible, hack:
class AccessToken(
"""An OAuth access token."""
@classmethod
def from_params(cls, params):
"""Create and return a new `AccessToken` from the given dict."""
key = params[
secret = params[
context = params.
return cls(key, secret, context)
@classmethod
def from_string(cls, query_string):
"""Create and return a new `AccessToken` from the given string."""
params = cgi.parse_
p = {}
for x in params:
k = x.decode('utf-8')
p[k] = []
key = p['oauth_token']
assert len(key) == 1, (
key = key[0]
secret = p['oauth_
assert len(secret) == 1, "Query string must have exactly one secret."
secret = secret[0]
context = params.
if context is not None:
return cls(key, secret, context)