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
Jérome Perrin
slapos.buildout
Commits
f7ac1f45
Commit
f7ac1f45
authored
Mar 01, 2018
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
download: use requests session to enable connection pooling
parent
3f32153f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
20 deletions
+8
-20
setup.py
setup.py
+1
-0
src/zc/buildout/download.py
src/zc/buildout/download.py
+7
-20
No files found.
setup.py
View file @
f7ac1f45
...
...
@@ -89,6 +89,7 @@ setup(
namespace_packages
=
[
'zc'
],
install_requires
=
[
'setuptools>=8.0'
,
'requests'
,
],
include_package_data
=
True
,
entry_points
=
entry_points
,
...
...
src/zc/buildout/download.py
View file @
f7ac1f45
...
...
@@ -31,28 +31,15 @@ try:
except
ImportError
:
# Python 2
import
base64
from
urlparse
import
urlparse
from
urlparse
import
urlunparse
import
urllib2
# use requests for connection pooling
import
requests
session
=
requests
.
Session
()
def
urlretrieve
(
url
,
tmp_path
):
"""Work around Python issue 24599 includig basic auth support
"""
scheme
,
netloc
,
path
,
params
,
query
,
frag
=
urlparse
(
url
)
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_path
,
'wb'
)
as
fp
:
fp
.
write
(
url_obj
.
read
())
return
tmp_path
,
url_obj
.
info
()
r
=
session
.
get
(
url
)
with
open
(
tmp_path
,
'wb'
)
as
fp
:
fp
.
write
(
r
.
content
)
return
tmp_path
,
r
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