Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.buildout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
slapos.buildout
Commits
f4258162
Commit
f4258162
authored
Aug 07, 2015
by
Reinout van Rees
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #253 from stefano-m/allow_download_behind_proxy_fix_32
Enable downloading behind a proxy by using urllib2
parents
eb0bc6bd
9de262f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
src/zc/buildout/download.py
src/zc/buildout/download.py
+16
-6
No files found.
src/zc/buildout/download.py
View file @
f4258162
...
...
@@ -22,17 +22,26 @@ try:
# Python 3
from
urllib.request
import
FancyURLopener
,
URLopener
,
urlretrieve
from
urllib.parse
import
urlparse
from
urllib
import
request
as
urllib
# for monkey patch below :(
from
urllib
import
request
class
PatchedURLopener
(
FancyURLopener
):
http_error_default
=
URLopener
.
http_error_default
request
.
_urlopener
=
PatchedURLopener
()
# Ook! Monkey patch!
except
ImportError
:
# Python 2
from
urllib
import
FancyURLopener
,
URLopener
,
urlretrieve
from
urlparse
import
urlparse
import
urllib
class
URLOpener
(
FancyURLopener
):
http_error_default
=
URLopener
.
http_error_default
import
urllib2
urllib
.
_urlopener
=
URLOpener
()
# Ook! Monkey patch!
def
urlretrieve
(
url
,
path
):
"""Work around Python issue 24599
"""
url_obj
=
urllib2
.
urlopen
(
url
)
with
open
(
path
,
'wb'
)
as
fp
:
fp
.
write
(
url_obj
.
read
())
return
path
,
url_obj
.
info
()
from
zc.buildout.easy_install
import
realpath
...
...
@@ -45,6 +54,7 @@ import sys
import
tempfile
import
zc.buildout
class
ChecksumError
(
zc
.
buildout
.
UserError
):
pass
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment