Commit 81e88815 authored by Lucas Carvalho's avatar Lucas Carvalho

Using PUT instead of POST and fixed the status.

parent 644db70b
......@@ -75,14 +75,14 @@ class NetworkcacheClient(object):
shacache_connection = httplib.HTTPConnection(self.shacache_host,
self.shacache_port)
try:
shacache_connection.request('POST', path, file_content,
shacache_connection.request('PUT', path, file_content,
self.shacache_header_dict)
result = shacache_connection.getresponse()
data = result.read()
finally:
shacache_connection.close()
if result.status != 200:
if result.status != 201:
raise UploadError('Failed to upload the file to SHACACHE Server.' \
'URL: %s. Response code: %s. Response data: %s' % \
(self.shacache_host, result.status, data))
......@@ -106,14 +106,14 @@ class NetworkcacheClient(object):
shadir_connection = httplib.HTTPConnection(self.shadir_host,
self.shadir_port)
try:
shadir_connection.request('POST', path, json.dumps(data),
shadir_connection.request('PUT', path, json.dumps(data),
self.shadir_header_dict)
result = shadir_connection.getresponse()
data = result.read()
finally:
shadir_connection.close()
if result.status != 200:
if result.status != 201:
raise UploadError('Failed to upload data to SHADIR Server.' \
'URL: %s. Response code: %s. Response data: %s' % \
(self.shacache_host, result.status, data))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment