Skip to content

[Bug]: failed to do request: Get "https://get.ja3.zone/": tls: unknown ClientHelloID: Custom-1' #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tngo-tool98 opened this issue May 27, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@tngo-tool98
Copy link

tngo-tool98 commented May 27, 2025

TLS Requests version

wrapper-tls-requests==1.1.4

Issue description

import json
from datetime import datetime
from typing import Dict, Optional

import requests
import tls_requests

PROXY = "your-proxy" # Ex: http://username:password@ip:port
CUSTOM_TLS_CLIENT_CRHOME_133_KWARGS = {
    "alpnProtocols": [  # Done
        "h2",
        "http/1.1"
    ],
    "alpsProtocols": [  # Done
        "h2"
    ],
    "certCompressionAlgo": "brotli",    # Done
    "connectionFlow": 15663105,  # Done
    "h2Settings": {  # Done
        "HEADER_TABLE_SIZE": 65536,
        "ENABLE_PUSH": 0,
        "INITIAL_WINDOW_SIZE": 6291456,
        "MAX_HEADER_LIST_SIZE": 262144
    },
    "h2SettingsOrder": [    # Done
        "HEADER_TABLE_SIZE",
        "ENABLE_PUSH",
        "INITIAL_WINDOW_SIZE",
        "MAX_HEADER_LIST_SIZE"
    ],
    "headerPriority": None,
    "ja3String": "771,2570-4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,2570-0-23-65281-10-11-35-16-5-13-18-51-45-43-27-17513-2570-21,2570-29-23-24,0",
    "keyShareCurves": [
        "GREASE",
        "X25519"
    ],
    "priorityFrames": [],
    "pseudoHeaderOrder": [  # Done
        ":method",
        ":authority",
        ":scheme",
        ":path"
    ],
    "supportedSignatureAlgorithms": [   # Done
        "ECDSAWithP256AndSHA256",
        "PSSWithSHA256",
        "PKCS1WithSHA256",
        "ECDSAWithP384AndSHA384",
        "PSSWithSHA384",
        "PKCS1WithSHA384",
        "PSSWithSHA512",
        "PKCS1WithSHA512"
    ],
    "supportedVersions": [  # Done
        "GREASE",
        "1.3",
        "1.2"
    ]
}
CUSTOM_TLS_CLIENT = tls_requests.tls.CustomTLSClientConfig.from_kwargs(**CUSTOM_TLS_CLIENT_CRHOME_133_KWARGS)

def check_fingerprint(is_using_python_requests_lib: bool = False) -> Optional[Dict]:
    try:
        # if not mv.session_captcha:
        #     print("Can't get fingerprint: session_captcha is None.")
        #     return None

        try:
            url = "https://get.ja3.zone/"
            headers = {
                'accept': '*/*',
                'accept-language': "en-US,en;q=0.9",
                'cache-control': 'no-cache',
                'origin': 'https://ja3.zone',
                'pragma': 'no-cache',
                'priority': 'u=1, i',
                'referer': 'https://ja3.zone',
                'sec-ch-ua': '"Chromium";v="133", "Google Chrome";v="133", "Not A;Brand";v="99"',
                'sec-ch-ua-mobile': '?0',
                'sec-ch-ua-platform': '"Windows"',
                'sec-fetch-dest': 'empty',
                'sec-fetch-mode': 'cors',
                'sec-fetch-site': 'same-site',
                'user-agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
            }

            if is_using_python_requests_lib:
                response = requests.get(url, headers=headers, proxies=PROXY, verify=False)
            else:
                try:
                    response = tls_requests.get(
                        url,
                        proxy=PROXY,
                        http2=True,
                        headers=headers,
                        verify=True,
                        customTlsClient=CUSTOM_TLS_CLIENT,
                        tlsClientIdentifier=None
                    )
                except Exception as e:
                    print("Failed to get fingerprint: ", e)
                    return None
            if response.status_code == 200:
                if not response.text:
                    return None
                json_resp = json.loads(response.text)
                now = datetime.now()
                timestamp = now.strftime("%Y-%m-%d_%H-%M-%S")
                with open(f"tls_check/fingerprint_{timestamp}.json", "w", encoding="utf-8") as f:
                    json.dump(json_resp, f, indent=4)
                return json_resp
            else:
                return None
        except Exception as e:
            print("Failed to get fingerprint: ", e)
            return None
    except Exception as e:
        print("Can't get fingerprint: ", e)
        return None

Steps to reproduce / Code Sample

When I try to use a custom profile with the code above, I get the following error message

failed to do request: Get "https://get.ja3.zone/": tls: unknown ClientHelloID: Custom-1

I already rechecked it by using the shared library: https://github.com/bogdanfinn/tls-client/blob/master/cffi_dist/example_python/example_custom_client.py, and it worked.

Could you please re-test it? I really don't know what’s wrong with my collected TLS fingerprint.

@tngo-tool98 tngo-tool98 added the bug Something isn't working label May 27, 2025
@thewebscraping
Copy link
Owner

Hi @tngo-tool98,
I'm not sure, I will find out and check again about config. Temporarily you can use the following way:

https://github.com/bogdanfinn/tls-client/blob/master/cffi_dist/example_python/example_custom_client.py

requestPayload = {
    "followRedirects": False,
    "insecureSkipVerify": False,
    "withoutCookieJar": False,
    "withDefaultCookieJar": False,
    "isByteRequest": False,
    "forceHttp1": False,
    "catchPanics": False,
    "withDebug": False,
    "withRandomTLSExtensionOrder": False,
    "timeoutSeconds": 30,
    "timeoutMilliseconds": 0,
    "sessionId": "2my-session-id",
    "certificatePinningHosts": {},
    "customTlsClient": {
        "ja3String": "771,2570-4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,2570-0-23-65281-10-11-35-16-5-13-18-51-45-43-27-17513-2570-21,2570-29-23-24,0",
        "h2Settings": {
            "HEADER_TABLE_SIZE": 65536,
            "MAX_CONCURRENT_STREAMS": 1000,
            "INITIAL_WINDOW_SIZE": 6291456,
            "MAX_HEADER_LIST_SIZE": 262144
        },
        "h2SettingsOrder": [
            "HEADER_TABLE_SIZE",
            "MAX_CONCURRENT_STREAMS",
            "INITIAL_WINDOW_SIZE",
            "MAX_HEADER_LIST_SIZE"
        ],
        "supportedSignatureAlgorithms": [
            "ECDSAWithP256AndSHA256",
            "PSSWithSHA256",
            "PKCS1WithSHA256",
            "ECDSAWithP384AndSHA384",
            "PSSWithSHA384",
            "PKCS1WithSHA384",
            "PSSWithSHA512",
            "PKCS1WithSHA512",
        ],
        "supportedVersions": ["GREASE", "1.3", "1.2"],
        "keyShareCurves": ["GREASE", "X25519"],
        "certCompressionAlgos": ["brotli"],
        "alpnProtocols": ["h2", "http/1.1"],
        "alpsProtocols": ["h2"],
        "pseudoHeaderOrder": [
            ":method",
            ":authority",
            ":scheme",
            ":path"
        ],
        "connectionFlow": 15663105,
        "priorityFrames": [],
        "headerPriority": None,
    },
    "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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.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": []
}

r = tls_requests.get("https://get.ja3.zone/",  **requestPayload)

or

client = tls_requests.Client(**requestPayload)
r = client.get(url)
print(client.config.to_payload())

{'catchPanics': False,
 'certificatePinningHosts': {},
 'customTlsClient': {'ja3String': '771,2570-4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,2570-0-23-65281-10-11-35-16-5-13-18-51-45-43-27-17513-2570-21,2570-29-23-24,0',
  'h2Settings': {'HEADER_TABLE_SIZE': 65536,
   'MAX_CONCURRENT_STREAMS': 1000,
   'INITIAL_WINDOW_SIZE': 6291456,
   'MAX_HEADER_LIST_SIZE': 262144},
  'h2SettingsOrder': ['HEADER_TABLE_SIZE',
   'MAX_CONCURRENT_STREAMS',
   'INITIAL_WINDOW_SIZE',
   'MAX_HEADER_LIST_SIZE'],
  'supportedSignatureAlgorithms': ['ECDSAWithP256AndSHA256',
   'PSSWithSHA256',
   'PKCS1WithSHA256',
   'ECDSAWithP384AndSHA384',
   'PSSWithSHA384',
   'PKCS1WithSHA384',
   'PSSWithSHA512',
   'PKCS1WithSHA512'],
  'supportedVersions': ['GREASE', '1.3', '1.2'],
  'keyShareCurves': ['GREASE', 'X25519'],
  'certCompressionAlgos': ['brotli'],
  'alpnProtocols': ['h2', 'http/1.1'],
  'alpsProtocols': ['h2'],
  'pseudoHeaderOrder': [':method', ':authority', ':scheme', ':path'],
  'connectionFlow': 15663105,
  'priorityFrames': [],
  'headerPriority': None},
 'followRedirects': False,
 'forceHttp1': False,
 'headerOrder': ['accept', 'user-agent', 'accept-encoding', 'accept-language'],
 'headers': {'accept': '*/*',
  'connection': 'keep-alive',
  'user-agent': 'Python-TLS-Requests/1.1.4',
  'accept-encoding': 'gzip, deflate, br, zstd'},
 'insecureSkipVerify': False,
 'isByteRequest': False,
 'isByteResponse': True,
 'isRotatingProxy': False,
 'proxyUrl': '',
 'requestBody': None,
 'requestCookies': [],
 'requestMethod': None,
 'requestUrl': None,
 'sessionId': '01e2b030-ac99-4d7d-bb2f-0da1ce2c8996',
 'timeoutSeconds': 30,
 'tlsClientIdentifier': None,
 'withDebug': False,
 'withDefaultCookieJar': False,
 'withRandomTLSExtensionOrder': True,
 'withoutCookieJar': False}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy