Merge lp:~igorsantos07/rescuetime-linux-uploader/rescuetime-linux-uploader into lp:rescuetime-linux-uploader

Proposed by Igor Santos
Status: Merged
Merged at revision: 104
Proposed branch: lp:~igorsantos07/rescuetime-linux-uploader/rescuetime-linux-uploader
Merge into: lp:rescuetime-linux-uploader
Diff against target: 14 lines (+2/-3)
1 file modified
RescueTimeUploader/uploader.py (+2/-3)
To merge this branch: bzr merge lp:~igorsantos07/rescuetime-linux-uploader/rescuetime-linux-uploader
Reviewer Review Type Date Requested Status
Dirk T code inspection Approve
Review via email: mp+102544@code.launchpad.net

Description of the change

I was having problems on using the uploader under a proxy.
The current code sets proxy information only for HTTP, and the API uses HTTPS.
Anyway, there's no need of setting a dictionary of proxy URLs for ProxyHandler, since it uses the default environment vars the script was fetching. So I removed this part of the code and let ProxyHandler find all the proxy URLs the system has.

To post a comment you must log in.
Revision history for this message
Dirk T (miriup) wrote :

This is just a quick note that I will review the changes ASAP and get back to you. Please stay patient. ;)

Revision history for this message
Igor Santos (igorsantos07) wrote :

Thanks!
This is a bug that affects everyone under a proxy, but it doesn't appear
to have many users in the situation - as I didn't find anything under bugs
about this.

Anyway the fix was easy and I hope I have followed all the steps right to
get this fix onto the main codebase (:
[almost first time hacking with python and first time messing up with
bazaar haha]

Revision history for this message
Dirk T (miriup) wrote :

Confirmed that proxy configuration is taken from the environment:
http://docs.python.org/library/urllib2#urllib2.ProxyHandler

Revision history for this message
Dirk T (miriup) wrote :

Ok, works without problems without proxy. I'd assume Igor has tested it with proxy. Can't see anything that can go wrong, so fix will be committed.

review: Approve (code inspection)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'RescueTimeUploader/uploader.py'
2--- RescueTimeUploader/uploader.py 2010-03-12 17:47:30 +0000
3+++ RescueTimeUploader/uploader.py 2012-04-18 16:08:18 +0000
4@@ -29,9 +29,8 @@
5
6 RESCUETIME_API_URL = "https://api.rescuetime.com/api/"
7
8-if os.getenv('http_proxy') != None:
9- proxy_url = os.getenv('http_proxy')
10- proxy_support = urllib2.ProxyHandler({'http': proxy_url})
11+if os.getenv('http_proxy') != None or os.getenv('https_proxy') != None:
12+ proxy_support = urllib2.ProxyHandler()
13 opener = urllib2.build_opener(proxy_support, urllib2.HTTPHandler)
14 urllib2.install_opener(opener)
15

Subscribers

People subscribed via source and target branches