Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
File Transfer Service
fts-rest
Commits
f0fd3086
Commit
f0fd3086
authored
May 21, 2014
by
Alejandro Alvarez Ayllon
Browse files
Context.post_json improvements
parent
f90cfd3a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/fts3/rest/client/context.py
View file @
f0fd3086
# Copyright notice:
# Copyright Members of the EMI Collaboration, 2013.
#
#
# See www.eu-emi.eu for details on the copyright holders
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
...
@@ -144,7 +144,9 @@ class Context(object):
"%s/%s"
%
(
self
.
endpoint
,
path
))
def
post_json
(
self
,
path
,
body
):
if
not
isinstance
(
body
,
str
)
and
not
isinstance
(
body
,
unicode
):
body
=
json
.
dumps
(
body
)
return
self
.
_requester
.
method
(
'POST'
,
"%s/%s"
%
(
self
.
endpoint
,
path
),
body
,
headers
=
{
'Content-Type'
:
'
text
/json'
})
headers
=
{
'Content-Type'
:
'
application
/json'
})
Write
Preview
Supports
Markdown
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