FlorianREGAZ / Python-Tls-Client

Advanced HTTP Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't download any image using response.content

rageshhub opened this issue · comments

commented
# 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

Fixed it?

Is the problem solved? I have the same problem.

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

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