Merge lp:~sergiusens/phablet-tools/1225910 into lp:phablet-tools

Proposed by Sergio Schvezov
Status: Rejected
Rejected by: Sergio Schvezov
Proposed branch: lp:~sergiusens/phablet-tools/1225910
Merge into: lp:phablet-tools
Diff against target: 60 lines (+8/-5)
2 files modified
phabletutils/cdimage.py (+2/-2)
phabletutils/downloads.py (+6/-3)
To merge this branch: bzr merge lp:~sergiusens/phablet-tools/1225910
Reviewer Review Type Date Requested Status
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Needs Fixing
Andy Doan (community) Approve
PS Jenkins bot continuous-integration Approve
Ricardo Salveti Pending
Review via email: mp+192203@code.launchpad.net

Commit message

phablet-flash: added proxy support.

Description of the change

Limited testing with a basic tinyproxy and export http_proxy and https_proxy. I used --debug to see the http GETs go through the proxy.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andy Doan (doanac) wrote :

untested, but looks good

review: Approve
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Fails when tested against my squid proxy server on 12.04.

review: Needs Fixing

Unmerged revisions

211. By Sergio Schvezov

Adding proxy support

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'phabletutils/cdimage.py'
2--- phabletutils/cdimage.py 2013-08-22 22:25:37 +0000
3+++ phabletutils/cdimage.py 2013-10-22 17:32:05 +0000
4@@ -16,11 +16,11 @@
5
6 import logging
7 import re
8-import requests
9 import os.path
10 import subprocess
11 import urlparse
12
13+from phabletutils import downloads
14 from phabletutils import hashes
15 from phabletutils import fileutils
16 from phabletutils import resources
17@@ -31,7 +31,7 @@
18
19 def _get_elements(uri):
20 '''Scraps cdimage and returns a list of relevant links as elements.'''
21- request = requests.get(uri).content
22+ request = downloads.get_content(uri)
23 html_elements = filter(
24 lambda x: '<li><a href=' in x and
25 'Parent Directory' not in x and
26
27=== modified file 'phabletutils/downloads.py'
28--- phabletutils/downloads.py 2013-10-15 19:31:19 +0000
29+++ phabletutils/downloads.py 2013-10-22 17:32:05 +0000
30@@ -22,6 +22,7 @@
31 import os
32 import requests
33 import subprocess
34+import urllib
35
36 from xdg.BaseDirectory import xdg_config_home
37
38@@ -132,7 +133,7 @@
39
40 def get_content(uri):
41 '''Fetches the SHA256 sum file from cdimage.'''
42- content_request = requests.get(uri)
43+ content_request = requests.get(uri, proxies=urllib.getproxies())
44 if content_request.status_code != 200:
45 return None
46 else:
47@@ -142,9 +143,11 @@
48 def get_ubuntu_stamp(uri):
49 '''Downloads the jenkins build id from stamp file'''
50 try:
51- ubuntu_stamp = requests.get('%s/quantal-ubuntu_stamp' % uri)
52+ ubuntu_stamp = requests.get('%s/quantal-ubuntu_stamp' % uri,
53+ proxies=urllib.getproxies())
54 if ubuntu_stamp.status_code != 200:
55- ubuntu_stamp = requests.get('%s/ubuntu_stamp' % uri)
56+ ubuntu_stamp = requests.get('%s/ubuntu_stamp' % uri,
57+ proxies=urllib.getproxies())
58 if ubuntu_stamp.status_code != 200:
59 log.error('Latest build detection not supported... bailing')
60 exit(1)

Subscribers

People subscribed via source and target branches