Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
4377 Weergaven

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
Annuleer

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

Gerelateerde posts Antwoorden Weergaven Activiteit
1
nov. 18
3062
2
jul. 24
2663
1
jun. 24
5130
1
okt. 23
10839
1
okt. 23
98