Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
4366 Näkymät

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
Hylkää

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

Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
1
marrask. 18
3038
2
heinäk. 24
2653
1
kesäk. 24
5128
1
lokak. 23
10830
1
lokak. 23
98