Jumbled and random characters being outputted to console

Problem description:

I am making a request to an api and when I print what is being returned, it shows a bunch of jumbled random characters

Expected behavior:

I want to print to the correct json that is supposed to be returned. When I run this with a different IDE like visual studio code or pycharm it works fine.

Actual behavior:

Prints random unreadable characters that after sometimes turn into the actual response or just stay on the screen
image

Bug appears at this link:

https://catalog.roproxy.com/v1/catalog/items/details

Browser/OS/Device:

Windows 11 PC

That link isn’t to your Repl, could you please provide a link to it?

1 Like

hello, sorry but the code is private. i can give you an example api request snippet

response = session.post(
            "https://catalog.roproxy.com/v1/catalog/items/details",
            json=json_data,
            headers=headers)

          p = response.text
          print(p)

this would return something like

�’�����5�h\���@!z(�&I뒄�F�u�5n�N�K�bҒW
@�^�NkޟC�-I����d[Բ UE�6< �i�’uX6�����
!
@�^�NkޟC�-I����d[Բ

by the way it sometimes prints the correct json output but the entire console is just glitched

Still need help, i have tried different replits with the same result

Could you see if you see the same glitches on https://xtermjs.org/?

That looks suspiciously like data compressed with gzip, what headers are you sending to the server?

1 Like

thank you, headers was the problem

2 Likes

A post was split to a new topic: Jumbled and random characters being outputted to console - spam

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.