Skip to main content

Cliente HTTP avançado com TLS fingerprinting, rotação automática de proxies e recuperação inteligente para web scraping profissional

Project description

Notify TLS Client

PyPI version Python Version License: MIT

Cliente HTTP avançado em Python com suporte a TLS/SSL customizado, fingerprinting de navegadores e rotação automática de proxies. Construído sobre a biblioteca tls-client com funcionalidades adicionais para web scraping e automação resiliente.

🚀 Características Principais

  • Fingerprinting TLS Avançado: Emula múltiplos navegadores (Chrome, Firefox, Safari, Edge, Mobile)
  • Rotação Automática: Proxies e client identifiers com políticas configuráveis
  • Recuperação Automática: Reconexão inteligente em erros e respostas proibidas
  • Thread-Safe: Uso seguro em ambientes multi-threaded
  • Configuração Modular: Sistema de configuração baseado em objetos reutilizáveis
  • Presets Prontos: Configurações pré-definidas para casos de uso comuns
  • HTTP/3 Support: Suporte opcional a QUIC/HTTP3

📦 Instalação

pip install notify-tls-client

Requisitos

  • Python >= 3.12
  • Sistema operacional: Windows, macOS, Linux (x86_64, ARM64)

🎯 Quick Start

Uso Básico

from notify_tls_client import NotifyTLSClient

# Cliente com configuração padrão
client = NotifyTLSClient()

# Fazer requisição
response = client.get("https://api.example.com/data")
print(response.status_code)
print(response.json())

Usando Presets (Recomendado)

from notify_tls_client import NotifyTLSClient
from notify_tls_client.config import ClientConfiguration
from notify_tls_client.core.proxiesmanager import ProxiesManagerLoader

# Carregar proxies
proxies = ProxiesManagerLoader().from_txt("proxies.txt")

# Preset para scraping agressivo
config = ClientConfiguration.aggressive(proxies)
client = NotifyTLSClient(config)

# Fazer múltiplas requisições
for i in range(100):
    response = client.get("https://example.com/api/endpoint")
    print(f"Request {i}: {response.status_code}")

Configuração Customizada

from notify_tls_client import NotifyTLSClient
from notify_tls_client.config import (
    ClientConfiguration,
    RotationConfig,
    RecoveryConfig,
    ClientConfig
)

config = ClientConfiguration(
    proxies_manager=proxies,
    rotation=RotationConfig(
        requests_limit_same_proxy=50,
        requests_limit_same_client_identifier=200,
        random_tls_extension_order=True
    ),
    recovery=RecoveryConfig(
        instantiate_new_client_on_forbidden_response=True,
        instantiate_new_client_on_exception=True,
        change_client_identifier_on_forbidden_response=True,
        status_codes_to_forbidden_response_handle=[403, 429, 503]
    ),
    client=ClientConfig(
        client_identifiers=["chrome_133", "firefox_120", "safari_17_0"],
        disable_http3=False,
        debug_mode=False
    )
)

client = NotifyTLSClient(config)

📚 Presets Disponíveis

Simple

Uso básico com rotação de proxies padrão.

config = ClientConfiguration.simple(proxies)

Aggressive

Para scraping intensivo com recuperação automática completa.

config = ClientConfiguration.aggressive(proxies)
  • Troca proxy a cada 10 requisições
  • Troca client identifier a cada 50 requisições
  • Recuperação automática em erros e 403/429/503
  • Múltiplos client identifiers

Stealth

Foco em evitar detecção através de diversidade.

config = ClientConfiguration.stealth(proxies)
  • 4 client identifiers diferentes
  • Ordem de extensões TLS randomizada
  • Rotação moderada (100 req/proxy)

Mobile

Simula dispositivos móveis.

# Android
config = ClientConfiguration.mobile(proxies, platform="android")

# iOS
config = ClientConfiguration.mobile(proxies, platform="ios")

🔧 Funcionalidades Avançadas

Rotação de Proxies

from notify_tls_client.core.proxiesmanager import ProxiesManagerLoader

# Carregar de arquivo
proxies = ProxiesManagerLoader().from_txt("proxies.txt")

# Formato do arquivo (um por linha):
# host:port
# host:port:username:password
# http://username:password@host:port

Client Identifiers Suportados

Desktop:

  • Chrome: chrome_133, chrome_131, chrome_120, etc.
  • Firefox: firefox_120, firefox_117, firefox_110, etc.
  • Safari: safari_17_0, safari_16_0, etc.
  • Edge, Opera

Mobile:

  • Android: okhttp4_android_13, okhttp4_android_12, etc.
  • iOS: safari_ios_16_0, safari_ios_15_6, etc.

Recuperação Automática

config = ClientConfiguration(
    recovery=RecoveryConfig(
        # Criar nova sessão em respostas proibidas
        instantiate_new_client_on_forbidden_response=True,

        # Criar nova sessão em exceções
        instantiate_new_client_on_exception=True,

        # Trocar identifier em respostas proibidas
        change_client_identifier_on_forbidden_response=True,

        # Status codes que acionam recuperação
        status_codes_to_forbidden_response_handle=[403, 429, 503]
    )
)

Headers Customizados

config = ClientConfiguration(
    client=ClientConfig(
        default_headers={
            "User-Agent": "Mozilla/5.0...",
            "Accept-Language": "pt-BR,pt;q=0.9",
            "Custom-Header": "value"
        }
    )
)

# Ou por requisição
response = client.get(
    "https://example.com",
    headers={"Authorization": "Bearer token"}
)

Cookies

# Obter todos os cookies
cookies = client.get_cookies()

# Obter cookie específico
value = client.get_cookie_by_name("session_id")

# Definir cookie
client.set_cookie("name", "value")

🔒 Thread Safety

A biblioteca é thread-safe e pode ser usada em ambientes multi-threaded:

import concurrent.futures

client = NotifyTLSClient(ClientConfiguration.aggressive(proxies))

def make_request(url):
    return client.get(url)

with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor:
    urls = ["https://example.com"] * 100
    results = list(executor.map(make_request, urls))

📊 Logging

import logging

# Habilitar logs de debug
logging.basicConfig(level=logging.DEBUG)

# Ou configurar apenas para notify_tls_client
logger = logging.getLogger("notify_tls_client")
logger.setLevel(logging.DEBUG)

🛠️ Métodos HTTP Suportados

# GET
response = client.get(url, params={"key": "value"})

# POST
response = client.post(url, json={"data": "value"})
response = client.post(url, data="form data")

# PUT
response = client.put(url, json={"data": "value"})

# PATCH
response = client.patch(url, json={"data": "value"})

# DELETE
response = client.delete(url)

📖 Documentação Completa

Para documentação detalhada sobre arquitetura, componentes internos e exemplos avançados, consulte:

🤝 Contribuindo

Contribuições são bem-vindas! Por favor, leia CONTRIBUTING.md para detalhes sobre nosso código de conduta e processo de submissão de pull requests.

📝 Changelog

Veja CHANGELOG.md para histórico de versões e mudanças.

📄 Licença

Este projeto está licenciado sob a Licença MIT - veja o arquivo LICENSE para detalhes.

⚠️ Aviso Legal

Esta biblioteca é fornecida apenas para fins educacionais e de pesquisa. O uso desta ferramenta para violar termos de serviço de websites, realizar scraping não autorizado ou qualquer atividade ilegal é de sua responsabilidade. Os desenvolvedores não se responsabilizam pelo uso indevido desta biblioteca.

🙏 Agradecimentos

  • tls-client - Biblioteca Go subjacente para TLS fingerprinting
  • Comunidade Python por ferramentas e bibliotecas incríveis

📞 Suporte


Desenvolvido com ❤️ para a comunidade Python

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

notify_tls_client-2.5.0.tar.gz (23.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

notify_tls_client-2.5.0-py3-none-any.whl (23.2 MB view details)

Uploaded Python 3

File details

Details for the file notify_tls_client-2.5.0.tar.gz.

File metadata

  • Download URL: notify_tls_client-2.5.0.tar.gz
  • Upload date:
  • Size: 23.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for notify_tls_client-2.5.0.tar.gz
Algorithm Hash digest
SHA256 62d48a27ec75138652d4c52dee3b2f610082eeedfe1ac4810d18e571e305762c
MD5 ddeffc9070f8013c53f4ee0ace862378
BLAKE2b-256 93fd05082198ff2b7c5e291e43ee8f9bc6dd1c39adccb8a5ea363ee8f2b2a770

See more details on using hashes here.

Provenance

The following attestation bundles were made for notify_tls_client-2.5.0.tar.gz:

Publisher: publish.yml on jefersonAlbara/notify-tls-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file notify_tls_client-2.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for notify_tls_client-2.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1379fa267589dd2b037ef0144164c3d0460b966c9a669104543629ef845d2f7c
MD5 b59fcee1d7541deb169d5f2668058daf
BLAKE2b-256 bedcf952dda4c7961c2838ddf88ff8cceae6867c48e2124251b11724618fee52

See more details on using hashes here.

Provenance

The following attestation bundles were made for notify_tls_client-2.5.0-py3-none-any.whl:

Publisher: publish.yml on jefersonAlbara/notify-tls-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page