Where exactly is the 401 happening?
In [1]: from launchpadlib.launchpad import Launchpad, STAGING_SERVICE_ROOT
In [2]: launchpad = Launchpad.get_token_and_login('test login on staging', STAGING_SERVICE_ROOT)
The authorization page (https://staging.launchpad.net/+authorize-token?oauth_token=xlnP2n1zN6R9P81TPlHH) should be opening in your browser. After you have authorized this program to access Launchpad on your behalf you should come back here and press <Enter> to finish the authentication process.
/media/disk-1/lp_api/launnchpadlib/trunk/launchpadlib/launchpad.pyc in get_token_and_login(cls, consumer_name, service_root, cache, timeout, proxy_info)
151 "here and press <Enter> to finish the authentication "
152 "process." % authorization_url)
153 sys.stdin.readline()
154 credentials.exchange_request_token_for_access_token(web_root)
--> 155 return cls(credentials, service_root, cache, timeout, proxy_info)
/media/disk-1/lp_api/launnchpadlib/trunk/launchpadlib/launchpad.pyc in __init__(self, credentials, service_root, cache, timeout, proxy_info)
58 # Get the WADL definition.
59 self._browser = Browser(self.credentials, cache, timeout, proxy_info)
---> 60 self._wadl = self._browser.get_wadl_application(self._root_uri)
61
62 # Get the root resource.
/media/disk-1/lp_api/launnchpadlib/trunk/launchpadlib/_browser.pyc in get_wadl_application(self, url)
227 """GET a WADL representation of the resource at the requested url."""
228 response, content = self._request(
--> 229 url, media_type='application/vd.sun.wadl+xml')
230 return Application(str(url), content)
231
Where exactly is the 401 happening? launchpad import Launchpad, STAGING_ SERVICE_ ROOT
In [1]: from launchpadlib.
In [2]: launchpad = Launchpad. get_token_ and_login( 'test login on staging', STAGING_ SERVICE_ ROOT) /staging. launchpad. net/+authorize- token?oauth_ token=xlnP2n1zN 6R9P81TPlHH) should be opening in your browser. After you have authorized this program to access Launchpad on your behalf you should come back here and press <Enter> to finish the authentication process.
The authorization page (https:/
------- ------- ------- ------- ------- ------- ------- ------- ------- ------- -----
HTTPError Traceback (most recent call last)
/home/markus/ <ipython console> in <module>()
/media/ disk-1/ lp_api/ launnchpadlib/ trunk/launchpad lib/launchpad. pyc in get_token_ and_login( cls, consumer_name, service_root, cache, timeout, proxy_info) readline( ) exchange_ request_ token_for_ access_ token(web_ root)
151 "here and press <Enter> to finish the authentication "
152 "process." % authorization_url)
153 sys.stdin.
154 credentials.
--> 155 return cls(credentials, service_root, cache, timeout, proxy_info)
/media/ disk-1/ lp_api/ launnchpadlib/ trunk/launchpad lib/launchpad. pyc in __init__(self, credentials, service_root, cache, timeout, proxy_info) self.credential s, cache, timeout, proxy_info) get_wadl_ application( self._root_ uri)
58 # Get the WADL definition.
59 self._browser = Browser(
---> 60 self._wadl = self._browser.
61
62 # Get the root resource.
/media/ disk-1/ lp_api/ launnchpadlib/ trunk/launchpad lib/_browser. pyc in get_wadl_ application( self, url) 'application/ vd.sun. wadl+xml' ) str(url) , content)
227 """GET a WADL representation of the resource at the requested url."""
228 response, content = self._request(
--> 229 url, media_type=
230 return Application(
231
/media/ disk-1/ lp_api/ launnchpadlib/ trunk/launchpad lib/_browser. pyc in _request(self, url, data, method, media_type, extra_headers)
209 # Turn non-2xx responses into exceptions.
210 if response.status // 100 != 2:
--> 211 raise HTTPError(response, content)
212 return response, content
213
HTTPError: HTTP Error 401: Unauthorized
In [3]:
So did the authorization process completed succesfully? Can you see the tokens in your tokens list
Yes this token is on that list