Unable to access launchpadlib with authenticated launchpad access
I am able to fetch the launchpad data using login_anonymously to launchpadlib.
Now, I have an account on Launchpad and I want to access launchpadlib data using my credentials of Launchpad.
How, do I get the authenticated access. Any link/example/lines of code, Pls help ??
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- William Grant
- Solved:
- Last query:
- Last reply:
Revision history for this message
|
#1 |
You want the login_with method. See https:/
Revision history for this message
|
#2 |
Hi William,
Thanks for your prompt response.
However, I have already checked this link out and this is not what I am looking for. This link decribes the scenario when I want to have launchpad integrated on my custom website.
I will again explain the problem here-
"I have a launchpad account and bugs assigned to me in eg:openstack project. Now I want to have read-write access on my bugs of openstack."
As an anonymous user, I am able to fetch the details using--
####
from launchpadlib.
cachedir = "/home/
launchpad = Launchpad.
openstack_data = launchpad.
people = launchpad.people
my_bug = launchpad.
assigned_tasks = openstack_
assigned_bugs = [task.bug for task in assigned_tasks]
print assigned_bugs
####
What if I want to login into launchpad using my credentials and have write access also to my own bugs??
There, this question remains unanwered for me. Kindly help with any suggestions.
Thanks.
Revision history for this message
|
#3 |
The "Authenticated access for website integration" section describes how to integrate it in a website, but the "Authenticated access" section that I linked shows how to do it in a script. Just replace "login_anonymously" with "login_with" in the code you have.
Revision history for this message
|
#4 |
Hi William,
I tried using -
"import sys
from launchpadlib.
def no_credential():
print "Can't proceed without Launchpad credential."
sys.exit()
launchpad = Launchpad.
'My Application', 'staging', credential_
It gave me error saying ----
"raise ServerNotFoundE
httplib2.
Suppose, I want to get write access of launchpad project (eg: horizon) bugs.
The link is https:/
What are the steps to do that?? In the answer you provided, how am I providing the launchpad credentials in my code?
Revision history for this message
|
#5 |
In the normal workflow you don't provide your credentials directly. If you're running the script on your local machine, it will print a URL the first time to open in your web browser. That URL lets you authenticate the script to Launchpad, and it will store the credentials in your desktop keyring. Further runs of the script will use the stored credentials and not prompt for them.\
staging.
Revision history for this message
|
#6 |
Hi William,
I am back on trying this out. I will share an example with you so that you can understand it better-
I am an authenticated user of launchpad.net. Now I want to login with my launchpad credentials to access this site's data.
I am able to do this as a public user and can login anonymously using-
launchpad = Launchpad.
people = launchpad.people
swati = people.
print swati.display_name
But I am not able to use the 'login_with()' method of the API to login directly with my launchpad credentials and access its data.
Please share any commands if you have in mind for this.
Thanks and Regards.
Revision history for this message
|
#7 |
"But I am not able to use the 'login_with()' method of the API to login directly with my launchpad credentials and access its data."
Why not?
Revision history for this message
|
#8 |
Hi William,
I am checking this- https:/
launchpad = Launchpad.
Here, where do I give my launchpad.net username and password to enter into my account and access my profile data??
Thanks in advance.
Revision history for this message
|
#9 |
launchpadlib uses OAuth to authenticate, not your username and password directly. login_with prints a URL that you need to visit in your web browser, using your Launchpad cookie or email address and password to authorize launchpadlib's OAuth token to access your Launchpad account.
Revision history for this message
|
#10 |
Hi William,
Thanks for your responses.
I tried this-
from launchpadlib.
credentials = Credentials("my website")
request_token_info = credentials.
but everytime when I use "staging" or "production", I get the same error-
httplib2.
OR
httplib2.
Is there a problem in generating a token for the site, or there is a downtime currently??
Revision history for this message
|
#11 |
>>> c = Credentials("foo")
>>> rt = c.get_request_
>>> rt
u'https:/
Are you sure that machine has network access and DNS configured correctly?
Revision history for this message
|
#12 |
Thanks William, it worked out when I tried on another system.
Now, when I proceed to -
exchange_
launchpad = Launchpad(
Here, we are again getting the error 'Type Error: __init__() Takes atleast 4 arguments(3 given)'...
Then if I try launchpad = Launchpad(
I was also going through some other chat of 2013, where it was mentioned that the Launchpad API has changed now, but the people have not changed their documentation. And now, if people request the Launchpad developers for Launchpad SSO, then they grant access........ Is this true?? What should be my next step to get this working??
Revision history for this message
|
#13 |
On 22/04/15 08:06, Swati Sharma wrote:
> Question #262376 on Launchpad itself changed:
> https:/
>
> Status: Needs information => Open
>
> Swati Sharma gave more information on the question:
> Thanks William, it worked out when I tried on another system.
>
> Now, when I proceed to -
>
> exchange_
> an authorized access token will be present in credentials.
> Then, we can then pass the Credentials object into the Launchpad
> constructor.
>
> launchpad = Launchpad(
>
>
> Here, we are again getting the error 'Type Error: __init__() Takes atleast 4 arguments(3 given)'...
>
> Then if I try launchpad = Launchpad(
> service_
> __init__() Takes atleast 4 arguments(4 given)'...
>>> c = Credentials("foo")
>>> c.get_request_
u'https:/
>>> # Authorise access using web browser.
>>> c.exchange_
>>> lp = Launchpad(c, None, None, service_
>>> lp.me
<person at https:/
> I was also going through some other chat of 2013, where it was mentioned
> that the Launchpad API has changed now, but the people have not changed
> their documentation. And now, if people request the Launchpad developers
> for Launchpad SSO, then they grant access........ Is this true?? What
> should be my next step to get this working??
I don't understand what you mean about SSO.
Revision history for this message
|
#14 |
Hi William,
SSO means Launchpad single sign-on. I was able to do the steps that you suggested and access my profile details.
Currently, "Website integration" steps are successfully running, where once the user logs in first time and he visits the URL, he is able to login later using the desktop keyring credentials.
Now, I am using my "Mobile application" coded in Android, and I want to try out the same thing thing of logging in launchpad. How will it get the URL and store the keyring in this scenario?
Revision history for this message
|
#15 |
launchpadlib just provides the URL and the methods that you have to call. It's up to your application to interact with the user.
Revision history for this message
|
#16 |
Thanks William Grant, that solved my question.