Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
18
Merge Requests
18
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
16ca1f2c
Commit
16ca1f2c
authored
May 22, 2019
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slap: Use CacheControl on client side for respect HTTP Cache queries.
parent
909bc0ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
setup.py
setup.py
+2
-0
slapos/slap/slap.py
slapos/slap/slap.py
+8
-1
No files found.
setup.py
View file @
16ca1f2c
...
...
@@ -60,6 +60,8 @@ setup(name=name,
'cliff'
,
'requests>=2.4.3'
,
'six'
,
'cachecontrol'
,
'lockfile'
,
'uritemplate'
,
# used by hateoas navigator
]
+
additional_install_requires
,
extras_require
=
{
...
...
slapos/slap/slap.py
View file @
16ca1f2c
...
...
@@ -63,6 +63,8 @@ requests.packages.urllib3.disable_warnings()
urllib3_logger
=
logging
.
getLogger
(
'requests.packages.urllib3'
)
urllib3_logger
.
setLevel
(
logging
.
WARNING
)
from
cachecontrol
import
CacheControl
from
cachecontrol.caches.file_cache
import
FileCache
# XXX fallback_logger to be deprecated together with the old CLI entry points.
fallback_logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -703,6 +705,11 @@ class ConnectionHelper:
self
.
master_ca_file
=
master_ca_file
self
.
timeout
=
timeout
# self.session will handle requests using HTTP Cache Control rules.
self
.
uncached_session
=
requests
.
Session
()
self
.
session
=
CacheControl
(
self
.
uncached_session
),
cache
=
FileCache
(
os
.
path
.
expanduser
(
"~/.slapos_cached_get"
))
def
getComputerInformation
(
self
,
computer_id
):
xml
=
self
.
GET
(
'getComputerInformation'
,
params
=
{
'computer_id'
:
computer_id
})
return
loads
(
xml
)
...
...
@@ -797,7 +804,7 @@ class ConnectionHelper:
return
req
def
GET
(
self
,
path
,
params
=
None
,
headers
=
None
):
req
=
self
.
do_request
(
requests
.
get
,
req
=
self
.
do_request
(
self
.
session
.
get
,
path
=
path
,
params
=
params
,
headers
=
headers
)
...
...
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