bogdanfinn / tls-client

net/http.Client like HTTP Client with options to select specific client TLS Fingerprints to use for requests.
BSD 4-Clause "Original" or "Old" License
670 stars 133 forks source link

[Bug]: not possible to set transportOptions when using tls-client-windows-64.dll #59

Closed Jamucy closed 10 months ago

Jamucy commented 11 months ago

TLS client version

v1.4.0

System information

Windows 10 Python 3.9

Issue description

Hi

is not possible to set transportOptions when using tls-client-windows-64.dll with python?

in particular im trying to define the IdleConnectionTimeout but nothing i have tried seems to be working.

sometimes i need to pause for a few min between request but need the connection kept alive for the next request. but atm it doesnt seem possible

Steps to reproduce / Code Sample

TransportOptions = {
    "DisableKeepAlives": False,
    "IdleConnTimeout": 0
}

requestPayload = {
    "transportOptions": TransportOptions,
    "tlsClientIdentifier": "chrome_112",
    "followRedirects": False,
    "withoutCookieJar": True,
    "withDebug": False,
    "catchPanics": True,
    "withRandomTLSExtensionOrder": True,
    "timeoutSeconds": 30,
    "sessionId": "my-session-id",
    "proxyUrl": "",
    "isRotatingProxy": False,
    "headers": {
        "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
        "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "accept-encoding": "gzip, deflate, br",
        "accept-language": "de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7"
    },
    "headerOrder": [
        "accept",
        "user-agent",
        "accept-encoding",
        "accept-language"
    ],
    "requestUrl": "https://microsoft.com",
    "requestMethod": "GET",
    "requestBody": "",
    "requestCookies": []
}

while True:
    response = request(json.dumps(requestPayload).encode('utf-8'))
    response_bytes = ctypes.string_at(response)
    response_string = response_bytes.decode('utf-8')
    response_object = json.loads(response_string)
    sleep(120)
bogdanfinn commented 11 months ago

@Jamucy you are right. we are missing the options. Will add them in the next version

bogdanfinn commented 11 months ago

@Jamucy please check out release 1.5.0