Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
4358 Prikazi

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
Opusti

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

Related Posts Odgovori Prikazi Aktivnost
1
nov. 18
3031
2
jul. 24
2649
1
jun. 24
5126
1
okt. 23
10827
1
okt. 23
98