X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osmclient%2Fsol005%2Fnsd.py;h=b1344614dd580d5eacbd7b2e56390db0a5e442cf;hb=ab51ef7a920bfb6d036d18ae5f3063a0d780cab2;hp=0dbec4352455796b459690dec244bf4cb6edf582;hpb=be96096ebd71c8d36c8375387f8e671f12eedfb0;p=osm%2Fosmclient.git diff --git a/osmclient/sol005/nsd.py b/osmclient/sol005/nsd.py index 0dbec43..b134461 100644 --- a/osmclient/sol005/nsd.py +++ b/osmclient/sol005/nsd.py @@ -23,8 +23,9 @@ from osmclient.common.exceptions import ClientException from osmclient.common import utils import json import magic +from os.path import basename #from os import stat -#from os.path import basename + class Nsd(object): @@ -126,9 +127,10 @@ class Nsd(object): raise ClientException( "failed to guess MIME type for file '{}'".format(filename)) headers= self._client._headers - if mime_type in ['application/yaml', 'text/plain']: - headers['Content-Type'] = 'application/yaml' - elif mime_type == 'application/gzip': + headers['Content-Filename'] = basename(filename) + if mime_type in ['application/yaml', 'text/plain', 'application/json']: + headers['Content-Type'] = 'text/plain' + elif mime_type in ['application/gzip', 'application/x-gzip']: headers['Content-Type'] = 'application/gzip' #headers['Content-Type'] = 'application/binary' # Next three lines are to be removed in next version @@ -164,6 +166,8 @@ class Nsd(object): raise ClientException('unexpected response from server - {}'.format( resp)) print(resp['id']) + elif http_code == 204: + print('Updated') else: msg = "Error {}".format(http_code) if resp: