I’m trying to download an image using the tls_client library, but the script I’ve created seems to have downloaded something that I can’t open. Just to inform you, I can download the image using the requests library without any issues.
import tls_client
image_link = 'https://cdn.pixabay.com/photo/2016/11/29/12/13/fence-1869401_960_720.jpg'
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:101.0) Gecko/20100101 Firefox/101.0',
}
session = tls_client.Session(client_identifier="firefox113")
response = session.get(image_link,headers=headers)
print(response.status_code)
with open("image.jpg","wb") as f:
f.write(response.content)
How can I download an image using this tls_client library?