Skip to Content
Menu
This question has been flagged
3687 Views

Hello Guys!!

Is there anyone wwho can help me know why i am getting this error: Function declared as capable of handling request of type 'http' but called with a request of type 'json'.

What i have get is that the problem is ith this :

    def upload(self, data, filename=False):

        assert len(data) > 0

        data = b64encode(data).decode('utf8')

        identifier = False

        data_size = len(data)

        upload_complete = False

        for i in range(0, data_size, CHUNK_LENGTH):

            client = requests.session()

            chunk = data[i:i+CHUNK_LENGTH]

            is_last = (i+CHUNK_LENGTH) >= data_size

            payload = self._initpack('upload')

            payload['params'].update({'data':chunk, 'identifier':identifier,

                                       'is_last': is_last})

            response = requests.post(url=self.url, data = json.dumps(payload))

            self._checkerror(response)

            if 'result' not in response:

                break

            elif 'identifier' not in response['result']:

                break

            elif is_last:

                upload_complete = True

            identifier = identifier or response['result']['identifier']

        return identifier or False

Need your help please
Avatar
Discard

You're probably calling this function from the JS in your Odoo website in a JSON call format, not as HTTP?

Related Posts Replies Views Activity
1
Nov 18
2259
2
Jul 24
939
1
Jun 24
3560
1
Oct 23
8582
1
Oct 23
97