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.1.tar.gz (52.6 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.1-py3-none-any.whl (52.9 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: notify_tls_client-2.5.1.tar.gz
  • Upload date:
  • Size: 52.6 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.1.tar.gz
Algorithm Hash digest
SHA256 7fec19f0388aa201110db56901639ef389c1b7f33690f5b6626c3e8008ddcd22
MD5 c21ed48c8ad0800c283e69dd8ce4fcf2
BLAKE2b-256 1f38570a9a6c34900cb32adb5caf3f78fdc7215c1cfd7d69e4dca500168bc81b

See more details on using hashes here.

Provenance

The following attestation bundles were made for notify_tls_client-2.5.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for notify_tls_client-2.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c4f64d66ab4a2c19b12c5da505fbd6cf0f1e70ce661774f27ec9059d061947d3
MD5 81fb287b6da65d9c4e5e45a54926a55b
BLAKE2b-256 967151fe293ce4afdffecf474d15559cb5f5cf1f65ac8db8ad881eeb615a5cc7

See more details on using hashes here.

Provenance

The following attestation bundles were made for notify_tls_client-2.5.1-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