Issue 10780

Title
'TypeError: Object of type bytes is not JSON serializable' in account_fr_chorus
Priority
bug
Status
resolved
Nosy list
ced, reviewbot, roundup-bot, solenepetit
Assigned to
ced
Keywords
review

Created on 2021-09-22.16:13:28 by solenepetit, last changed 6 days ago by roundup-bot.

Messages

New changeset a33a3767c9b9 by Cédric Krier in branch '6.0':
Convert payload base64 bytes into ASCII string
https://hg.tryton.org/modules/account_fr_chorus/rev/a33a3767c9b9

New changeset fd29bee54e44 by Cédric Krier in branch '5.8':
Convert payload base64 bytes into ASCII string
https://hg.tryton.org/modules/account_fr_chorus/rev/fd29bee54e44

New changeset 1a92afbd4b30 by Cédric Krier in branch '5.0':
Convert payload base64 bytes into ASCII string
https://hg.tryton.org/modules/account_fr_chorus/rev/1a92afbd4b30
New changeset 25068e1de9b4 by Cédric Krier in branch 'default':
Convert payload base64 bytes into ASCII string
https://hg.tryton.org/tryton-env/rev/25068e1de9b4
New changeset 1d7367f5a6f0 by Cédric Krier in branch 'default':
Convert payload base64 bytes into ASCII string
https://hg.tryton.org/modules/account_fr_chorus/rev/1d7367f5a6f0
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-10-02.00:40:56

Here is review364141002 which should fix the problem.

Author: [hidden] (solenepetit)
Date: 2021-09-22.16:13:28

This issue follows another issue reported here
Using this patch, and reproducing the same steps described in this message, here is the new error message :

Traceback (most recent call last):
  File "/trytond/wsgi.py", line 117, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 47, in rpc
    return methods.get(request.rpc_method, _dispatch)(
  File "/trytond/wsgi.py", line 84, in auth_required
    return wrapped(*args, **kwargs)
  File "/trytond/protocols/wrappers.py", line 156, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 181, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/model/descriptors.py", line 33, in newfunc
    return self.func(owner, *args, **kwargs)
  File "/trytond/model/modelview.py", line 774, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/trytond_company-6.0.0-py3.8.egg/trytond/modules/company/ir.py", line 111, in run_once
    super(Cron, cls).run_once([cron])
  File "/trytond/model/descriptors.py", line 33, in newfunc
    return self.func(owner, *args, **kwargs)
  File "/trytond/model/modelview.py", line 774, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/trytond/ir/cron.py", line 141, in run_once
    getattr(Model, method)()
  File "/trytond/modules/account_fr_chorus/account.py", line 208, in send
    resp = Credential.post('factures/deposer/flux', payload)
  File "/trytond/modules/account_fr_chorus/account.py", line 99, in post
    resp = requests.post(
  File "/requests/api.py", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/requests/sessions.py", line 528, in request
    prep = self.prepare_request(req)
  File "/requests/sessions.py", line 456, in prepare_request
    p.prepare(
  File "/requests/models.py", line 319, in prepare
    self.prepare_body(data, files, json)
  File "/requests/models.py", line 469, in prepare_body
    body = complexjson.dumps(json)
  File "/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable
History
Date User Action Args
2021-10-12 14:57:33roundup-botsetmessages: + msg70958
2021-10-08 19:14:29roundup-botsetmessages: + msg70786
2021-10-08 19:14:20roundup-botsetmessages: + msg70785
nosy: + roundup-bot
status: testing -> resolved
2021-10-02 01:10:31reviewbotsetmessages: + msg70550
nosy: + reviewbot
2021-10-02 00:40:56cedsetassignedto: solenepetit -> ced
keyword: + review
messages: + msg70549
reviews: 364141002
status: in-progress -> testing
2021-09-24 10:42:16cedsetnosy: + ced
2021-09-23 17:22:16solenepetitsetassignedto: solenepetit
status: unread -> in-progress
2021-09-23 09:53:27solenepetitsettitle: TypeError: Object of type bytes is not JSON serializable -> 'TypeError: Object of type bytes is not JSON serializable' in account_fr_chorus
2021-09-23 09:52:51solenepetitsetcomponent: + account_fr_chorus
2021-09-22 16:13:28solenepetitcreate

Showing 10 items. Show all history (warning: this could be VERY long)