RFE: use login/password to create a temporary cookie

Bug #181138 reported by Markus Korn
2
Affects Status Importance Assigned to Milestone
python-launchpad-bugs
Fix Released
Undecided
Unassigned

Bug Description

authentication in py-lp-bugs currently works with the help of a valid mozilla cookie-file, like

Bug.authentication = <path to cookie-file>

It would be nice to have a mozilla and path independent solution like:

Bug.authentication = {"email":<email of lp-user>, "password":<password>}

Revision history for this message
Markus Korn (thekorn) wrote :

Fixed in my py-lp-bugs text.dev branch rev 100.

Example usage:
[...]
Bug.authentication = "/home/markus/.mozilla/firefox/foobarbaz.default/cookies.txt"
 or
Bug.authentication = {"email":"<email address hidden>","password":"***"}
[...]

Test case:
In [8]: from launchpadbugs.http_connection import HTTPConnection

In [9]: c = HTTPConnection()

In [10]: try:
   ....: c.get("https://bugs.edge.launchpad.net/python-launchpad-bugs/+filebug")
   ....: except Exception, e:
   ....: print e
   ....:
   ....:
'login failed https://bugs.edge.launchpad.net/python-launchpad-bugs/+filebug'

In [11]: c.set_auth("/home/markus/.gnome2/epiphany/mozilla/epiphany/cookies.txt")
Out[11]: False

In [12]: c.get("https://bFixed in my py-lp-bugs text.dev branch rev 100.

Example usage:
[...]
Bug.authentication = "/home/markus/.mozilla/firefox/foobarbaz.default/cookies.txt"
 or
Bug.authentication = {"email":"<email address hidden>","password":"***"}
[...]

Test case:
In [8]: from launchpadbugs.http_connection import HTTPConnection

In [9]: c = HTTPConnection()

In [10]: try:
   ....: c.get("https://bugs.edge.launchpad.net/python-launchpad-bugs/+filebug")
   ....: except Exception, e:
   ....: print e
   ....:
   ....:
'login failed https://bugs.edge.launchpad.net/python-launchpad-bugs/+filebug'

In [11]: c.set_auth("/home/markus/.gnome2/epiphany/mozilla/epiphany/cookies.txt")
Out[11]: False

In [12]: c.get("https://bugs.edge.launchpad.net/python-launchpad-bugs/+filebug")
Out[12]: <launchpadbugs.http_connection._result object at 0x152e4d0>

In [13]: c = HTTPConnection()

In [14]: c.set_auth({"email":"<email address hidden>","password":"*********"})

In [15]: c.get("https://bugs.edge.launchpad.net/python-launchpad-bugs/+filebug")
Out[15]: <launchpadbugs.http_connection._result object at 0x152e950>

Markusugs.edge.launchpad.net/python-launchpad-bugs/+filebug")
Out[12]: <launchpadbugs.http_connection._result object at 0x152e4d0>

In [13]: c = HTTPConnection()

In [14]: c.set_auth({"email":"<email address hidden>","password":"*********"})

In [15]: c.get("https://bugs.edge.launchpad.net/python-launchpad-bugs/+filebug")
Out[15]: <launchpadbugs.http_connection._result object at 0x152e950>

Markus

Changed in python-launchpad-bugs:
status: New → Fix Committed
Revision history for this message
Markus Korn (thekorn) wrote :

och, sorry, too tired for copy and paste :)
please remove the last 10 lines

Markus

Revision history for this message
Markus Korn (thekorn) wrote :

Sorry for the noise, but my last two comments are apparently a mess,
let's try again:

Fixed in my py-lp-bugs text.dev branch rev 100.

Example usage:
[...]
Bug.authentication = "/home/markus/.mozilla/firefox/foobarbaz.default/cookies.txt"
 or
Bug.authentication = {"email":"<email address hidden>","password":"***"}
[...]

Test case:
In [8]: from launchpadbugs.http_connection import HTTPConnection

In [9]: c = HTTPConnection()

In [10]: try:
   ....: c.get("https://bugs.edge.launchpad.net/python-launchpad-bugs/+filebug")
   ....: except Exception, e:
   ....: print e
   ....:
   ....:
'login failed https://bugs.edge.launchpad.net/python-launchpad-bugs/+filebug'

In [11]: c.set_auth("/home/markus/.gnome2/epiphany/mozilla/epiphany/cookies.txt")
Out[11]: False

In [12]: c.get("https://bugs.edge.launchpad.net/python-launchpad-bugs/+filebug")
Out[12]: <launchpadbugs.http_connection._result object at 0x152e4d0>

In [13]: c = HTTPConnection()

In [14]: c.set_auth({"email":"<email address hidden>","password":"*********"})

In [15]: c.get("https://bugs.edge.launchpad.net/python-launchpad-bugs/+filebug")
Out[15]: <launchpadbugs.http_connection._result object at 0x152e950>

Markus

Revision history for this message
Markus Korn (thekorn) wrote :

fix released with version 0.2.27 of py-lp-bugs in ubuntu

Changed in python-launchpad-bugs:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.