FlorianREGAZ / Python-Tls-Client

Advanced HTTP Library
MIT License
660 stars 136 forks source link

Can't download any image using response.content #83

Open rageshhub opened 1 year ago

rageshhub commented 1 year ago
# 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

Timmm0012 commented 11 months ago

Fixed it?

klaus2015 commented 7 months ago

Is the problem solved? I have the same problem.

ramismaris commented 7 months ago

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

Rabbbb1t commented 5 months ago

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