Python-Tls-Client icon indicating copy to clipboard operation
Python-Tls-Client copied to clipboard

Can't download any image using response.content

Open rageshhub opened this issue 2 years ago • 4 comments
trafficstars

# import requests
import tls_client
session = tls_client.Session(
    client_identifier="chrome112",
)
with open("image.png", 'wb') as f:
    r = session.get('https://img.freepik.com/free-photo/flowing-purple-mountain-spiral-bright-imagination-generated-by-ai_188544-9853.jpg?q=10&h=200')
    print(r.status_code)
    f.write(r.content)

I can write the image if I used request. But if I try using tls_client the image is corrupted

rageshhub avatar Aug 13 '23 16:08 rageshhub

Fixed it?

Timmm0012 avatar Oct 10 '23 19:10 Timmm0012

Is the problem solved? I have the same problem.

klaus2015 avatar Feb 14 '24 16:02 klaus2015

I have same problem but with .xlsx file. Someone solved it?

ramismaris avatar Feb 20 '24 17:02 ramismaris

this is a pointer to the response

    response = request(dumps(request_payload).encode('utf-8'))

from here the response is already wrong, "body":"\ufffd\ufffd\ufffd\ufffd\u0000\u0010JFIF' with so many \ufffd\ufffd\ufffd\ufffd wrong Unicode code

Rabbbb1t avatar Apr 02 '24 08:04 Rabbbb1t