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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hardik Juneja
slapos.core
Commits
fcb5a79e
Commit
fcb5a79e
authored
Nov 26, 2014
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos.slap hateoas: get 'me' document with no cache.
parent
9c6e8dab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
slapos/slap/slap.py
slapos/slap/slap.py
+12
-7
No files found.
slapos/slap/slap.py
View file @
fcb5a79e
# -*- coding: utf-8 -*-
# vim: set et sts=2:
##############################################################################
#
# Copyright (c) 2010, 2011, 2012 Vifib SARL and Contributors.
...
...
@@ -730,10 +731,11 @@ class ConnectionHelper:
return
req
def
GET
(
self
,
path
,
params
=
None
):
def
GET
(
self
,
path
,
params
=
None
,
headers
=
None
):
req
=
self
.
do_request
(
requests
.
get
,
path
=
path
,
params
=
params
)
params
=
params
,
headers
=
headers
)
return
req
.
text
.
encode
(
'utf-8'
)
def
POST
(
self
,
path
,
params
=
None
,
data
=
None
,
...
...
@@ -876,10 +878,10 @@ class HateoasNavigator(object):
self
.
master_ca_file
=
master_ca_file
self
.
timeout
=
timeout
def
GET
(
self
,
uri
):
def
GET
(
self
,
uri
,
headers
=
None
):
connection_helper
=
ConnectionHelper
(
uri
,
self
.
key_file
,
self
.
cert_file
,
self
.
master_ca_file
,
self
.
timeout
)
return
connection_helper
.
GET
(
uri
)
return
connection_helper
.
GET
(
uri
,
headers
=
headers
)
def
hateoasGetLinkFromLinks
(
self
,
links
,
title
):
if
type
(
links
)
==
dict
:
...
...
@@ -900,8 +902,8 @@ class HateoasNavigator(object):
return
return
str
(
url
)
def
getSiteDocument
(
self
,
url
):
result
=
self
.
GET
(
url
)
def
getSiteDocument
(
self
,
url
,
headers
=
None
):
result
=
self
.
GET
(
url
,
headers
)
return
json
.
loads
(
result
)
def
getRootDocument
(
self
):
...
...
@@ -909,7 +911,10 @@ class HateoasNavigator(object):
cached_root_document
=
getattr
(
self
,
'root_document'
,
None
)
if
cached_root_document
:
return
cached_root_document
self
.
root_document
=
self
.
getSiteDocument
(
self
.
slapos_master_hateoas_uri
)
self
.
root_document
=
self
.
getSiteDocument
(
self
.
slapos_master_hateoas_uri
,
headers
=
{
'Cache-Control'
:
'no-cache'
}
)
return
self
.
root_document
def
getDocumentAndHateoas
(
self
,
relative_url
,
view
=
'view'
):
...
...
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