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
Yusei Tahara
slapos.buildout
Commits
c7041163
Commit
c7041163
authored
Apr 06, 2016
by
Reinout van Rees
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #291 from gyst/master
Turn proposed patch into a pull request.
parents
144830d8
cf09e206
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
src/zc/buildout/download.py
src/zc/buildout/download.py
+17
-6
No files found.
src/zc/buildout/download.py
View file @
c7041163
...
@@ -31,17 +31,28 @@ try:
...
@@ -31,17 +31,28 @@ try:
except
ImportError
:
except
ImportError
:
# Python 2
# Python 2
import
base64
from
urlparse
import
urlparse
from
urlparse
import
urlparse
from
urlparse
import
urlunparse
import
urllib2
import
urllib2
def
urlretrieve
(
url
,
path
):
def
urlretrieve
(
url
,
tmp
):
"""Work around Python issue 24599
"""Work around Python issue 24599
includig basic auth support
"""
"""
url_obj
=
urllib2
.
urlopen
(
url
)
scheme
,
netloc
,
path
,
params
,
query
,
frag
=
urlparse
(
url
)
with
open
(
path
,
'wb'
)
as
fp
:
auth
,
host
=
urllib2
.
splituser
(
netloc
)
if
auth
:
url
=
urlunparse
((
scheme
,
host
,
path
,
params
,
query
,
frag
))
req
=
urllib2
.
Request
(
url
)
base64string
=
base64
.
encodestring
(
auth
)[:
-
1
]
basic
=
"Basic "
+
base64string
req
.
add_header
(
"Authorization"
,
basic
)
else
:
req
=
urllib2
.
Request
(
url
)
url_obj
=
urllib2
.
urlopen
(
req
)
with
open
(
tmp
,
'wb'
)
as
fp
:
fp
.
write
(
url_obj
.
read
())
fp
.
write
(
url_obj
.
read
())
return
path
,
url_obj
.
info
()
return
tmp
,
url_obj
.
info
()
from
zc.buildout.easy_install
import
realpath
from
zc.buildout.easy_install
import
realpath
...
...
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