chrisstoreclient/client.py
def _post_put(self, request_method, url, data, descriptor_file=None):
        """
        Internal method to make either a POST or PUT request to the ChRIS store.
        """
        if descriptor_file is None:
            headers = {'Content-Type': self.content_type, 'Accept': self.content_type}
            files = None
            data = json.dumps(self._makeTemplate(data))
        else:
            # this is a multipart request
            headers = None
            files = {'descriptor_file': descriptor_file}
        try:
            if self.username or self.password:
                r = request_method(url, files=files, data=data,
                                   auth=(self.username, self.password),
                                   timeout=self.timeout, headers=headers)
            else:
                r = request_method(url, files=files, data=data, timeout=self.timeout,
                                   headers=headers)
        except (requests.exceptions.Timeout, requests.exceptions.RequestException) as e:
            raise StoreRequestException(str(e))
        return self._get_collection_from_response(r)

        Internal method to make either a POST or PUT request to the ChRIS store.
        
Internal method to make either a POST or PUT request to the ChRIS store.
Internal method to make either a POST or PUT request to the ChRIS store .
def _post_put(self, request_method, url, data, descriptor_file=None):
        if descriptor_file is None:
            headers = {'Content-Type': self.content_type, 'Accept': self.content_type}
            files = None
            data = json.dumps(self._makeTemplate(data))
        else:
            headers = None
            files = {'descriptor_file': descriptor_file}
        try:
            if self.username or self.password:
                r = request_method(url, files=files, data=data,
                                   auth=(self.username, self.password),
                                   timeout=self.timeout, headers=headers)
            else:
                r = request_method(url, files=files, data=data, timeout=self.timeout,
                                   headers=headers)
        except (requests.exceptions.Timeout, requests.exceptions.RequestException) as e:
            raise StoreRequestException(str(e))
        return self._get_collection_from_response(r)
def _post_put ( self , request_method , url , data , descriptor_file = None ) : if descriptor_file is None : headers = { 'Content-Type' : self . content_type , 'Accept' : self . content_type } files = None data = json . dumps ( self . _makeTemplate ( data ) ) else : headers = None files = { 'descriptor_file' : descriptor_file } try : if self . username or self . password : r = request_method ( url , files = files , data = data , auth = ( self . username , self . password ) , timeout = self . timeout , headers = headers ) else : r = request_method ( url , files = files , data = data , timeout = self . timeout , headers = headers ) except ( requests . exceptions . Timeout , requests . exceptions . RequestException ) as e : raise StoreRequestException ( str ( e ) ) return self . _get_collection_from_response ( r )
Internal method to make either a POST or PUT request to the ChRIS store.
Internal method to make either a POST or PUT request to the ChRIS store .
"""
        Internal method to make either a POST or PUT request to the ChRIS store.
        """ # this is a multipart request
self
request_method
url
data
descriptor_file