Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
4368 Ansichten

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
Verwerfen

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

Verknüpfte Beiträge Antworten Ansichten Aktivität
1
Nov. 18
3043
2
Juli 24
2653
1
Juni 24
5129
1
Okt. 23
10832
1
Okt. 23
98