Merge lp:~jamalta/gwibber/397297 into lp:gwibber/1.2

Proposed by Jamal Fanaian
Status: Rejected
Rejected by: Ken VanDine
Proposed branch: lp:~jamalta/gwibber/397297
Merge into: lp:gwibber/1.2
Diff against target: None lines
To merge this branch: bzr merge lp:~jamalta/gwibber/397297
Reviewer Review Type Date Requested Status
Alexander Sack (community) Needs Resubmitting
Review via email: mp+8544@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alexander Sack (asac) wrote :

please remove the commented code, e.g.:
  #def get_auth(self):
  ...

review: Needs Resubmitting
lp:~jamalta/gwibber/397297 updated
349. By Jamal Fanaian

Removed commented get_auth blocks

Revision history for this message
Jamal Fanaian (jamalta) wrote :

Sorry about that, I must have forgotten to push the changes when you asked
last week. I have pushed the changes now and they appear to be there. Do I
need to resubmit my merge proposal?

Jamal Fanaian
407.479.7533
http://jamalfanaian.com

On Sun, Jul 12, 2009 at 5:27 PM, Alexander Sack <email address hidden> wrote:

> Review: Resubmit
> please remove the commented code, e.g.:
> #def get_auth(self):
> ...
>
> --
> https://code.edge.launchpad.net/~jamalfanaian/gwibber/397297/+merge/8544<https://code.edge.launchpad.net/%7Ejamalfanaian/gwibber/397297/+merge/8544>
> You are the owner of lp:~jamalfanaian/gwibber/397297.
>

Unmerged revisions

349. By Jamal Fanaian

Removed commented get_auth blocks

348. By Jamal Fanaian

Provided the fix with using HTTPBasicAuth object to the laconica client

347. By Jamal Fanaian

The issue was resolved by using an urllib2.HTTPBasicAuthHandler to do authentication instead of passing the authentication header to urllib2.Request. Fixed the issue for twitter and identica.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'gwibber/microblog/identica.py'
2--- gwibber/microblog/identica.py 2009-06-21 01:17:53 +0000
3+++ gwibber/microblog/identica.py 2009-07-09 19:19:50 +0000
4@@ -122,16 +122,23 @@
5 def __init__(self, acct):
6 self.account = acct
7
8- def get_auth(self):
9- return "Basic %s" % base64.encodestring(
10- ("%s:%s" % (self.account["username"], self.account["private:password"]))).strip()
11+ #def get_auth(self):
12+ #return "Basic %s" % base64.encodestring(
13+ #("%s:%s" % (self.account["username"], self.account["private:password"]))).strip()
14
15 def public_enabled(self):
16 return self.account["public_enabled"]
17
18 def connect(self, url, data = None):
19+ # Set up urllib2 authentication
20+ password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
21+ password_mgr.add_password(None, url,
22+ self.account["username"], self.account["private:password"])
23+ urllib2.install_opener(urllib2.build_opener(
24+ urllib2.HTTPBasicAuthHandler(password_mgr)))
25+
26 return urllib2.urlopen(urllib2.Request(
27- url, data, {"Authorization": self.get_auth()})).read()
28+ url, data)).read()
29
30 def get_messages(self):
31 return simplejson.loads(self.connect(
32
33=== modified file 'gwibber/microblog/laconica.py'
34--- gwibber/microblog/laconica.py 2009-06-21 00:04:28 +0000
35+++ gwibber/microblog/laconica.py 2009-07-09 19:19:50 +0000
36@@ -127,13 +127,21 @@
37 if self.account["allow_insecure"]: return "http://" + d + path
38 return "https://" + d + path
39
40- def get_auth(self):
41- return "Basic %s" % base64.encodestring(
42- ("%s:%s" % (self.account["username"], self.account["private:password"]))).strip()
43+ #def get_auth(self):
44+ #return "Basic %s" % base64.encodestring(
45+ #("%s:%s" % (self.account["username"], self.account["private:password"]))).strip()
46
47 def connect(self, url, data = None):
48- return urllib2.urlopen(urllib2.Request(
49- self.url(url), data, {"Authorization": self.get_auth()}))
50+ url = self.url(url)
51+
52+ # Set up urllib2 authentication
53+ password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
54+ password_mgr.add_password(None, url,
55+ self.account["username"], self.account["private:password"])
56+ urllib2.install_opener(urllib2.build_opener(
57+ urllib2.HTTPBasicAuthHandler(password_mgr)))
58+
59+ return urllib2.urlopen(urllib2.Request(url, data))
60
61 def get_messages(self):
62 return simplejson.load(self.connect("/api/statuses/friends_timeline.json"))
63
64=== modified file 'gwibber/microblog/twitter.py'
65--- gwibber/microblog/twitter.py 2009-06-21 01:17:53 +0000
66+++ gwibber/microblog/twitter.py 2009-07-09 19:19:50 +0000
67@@ -159,13 +159,20 @@
68 self.account["username"] != None and \
69 self.account["private:password"] != None
70
71- def get_auth(self):
72- return "Basic %s" % base64.encodestring(
73- ("%s:%s" % (self.account["username"], self.account["private:password"]))).strip()
74+ #def get_auth(self):
75+ #return "Basic %s" % base64.encodestring(
76+ #("%s:%s" % (self.account["username"], self.account["private:password"]))).strip()
77
78 def connect(self, url, data = None):
79+ # Set up urllib2 authentication
80+ password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
81+ password_mgr.add_password(None, url,
82+ self.account["username"], self.account["private:password"])
83+ urllib2.install_opener(urllib2.build_opener(
84+ urllib2.HTTPBasicAuthHandler(password_mgr)))
85+
86 return urllib2.urlopen(urllib2.Request(
87- url, data, headers = {"Authorization": self.get_auth()})).read()
88+ url, data)).read()
89
90 def get_messages(self):
91 return simplejson.loads(self.connect(

Subscribers

People subscribed via source and target branches