Skip to main content

The spider_fingerprint project for python.

Project description

spider_fingerprint_py

Python bindings for the spider_fingerprint Rust crate.

spider_fingerprint_py allows you to easily generate browser fingerprint and stealth scripts. It's ideal for effective automation, web scraping, bot-test evasion, and security testing workflows.


Installation

Install from PyPI:

pip install spider_fingerprint_py

Quick Start

Here's how to generate a stealth emulation JavaScript in a few lines of Python:

from spider_fingerprint_py import (
    PyViewport,
    PyTier,
    PyFingerprintMode,
    generate_emulation_script,
)

# if you set the user-agent to an empty string a random agent is used.
user_agent = (
    "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) "
    "AppleWebKit/537.36 (KHTML, like Gecko) "
    "Chrome/120.0.0.0 Safari/537.36"
)

# Random viewport simulating a real user
viewport = PyViewport.random()

# Generate the fingerprint spoofing script
script = generate_emulation_script(
    user_agent=user_agent,
    tier=PyTier.Full,
    fingerprint_mode=PyFingerprintMode.Basic,
    dismiss_dialogs=True,
    viewport=viewport,
    eval_script=None
)

print("Stealth Emulation JavaScript:\n")
print(script)

Documentation

Below you'll find complete reference documentation for classes, enums, and functions provided by the spider_fingerprint_py Python library:


PyViewport (class)

Represents viewport configurations for browser fingerprint emulation.

Attribute Type Description
width int Viewport width in pixels
height int Viewport height in pixels
device_scale_factor float or None Device pixel ratio (e.g., 2.0 for Retina)
emulating_mobile bool Enable emulation of mobile-device behavior
is_landscape bool Landscape (True) or Portrait (False) orientation
has_touch bool Simulate touch-enabled devices

Usage Example:

viewport = PyViewport(1280, 720)
viewport.emulating_mobile = True
viewport.device_scale_factor = 2.0
viewport.is_landscape = False
viewport.has_touch = True

PyTier (enum)

Controls the aggressiveness and scope of stealth applied through fingerprint spoofing.

Variant Description
Basic Basic stealth spoofing capabilities including GPU/WebGL spoofing.
BasicWithConsole Basic stealth mode combined with console output (for debugging).
BasicNoWebgl Basic stealth spoofing without WebGL spoofing techniques.
Mid Intermediate stealth protections with improved spoofing coverage.
Full Comprehensive stealth protections covering most fingerprinting.
None No spoofing; original browser fingerprint exposed fully.

Example:

tier = PyTier.Full

PyAgentOs (enum)

Defines operating system target profiles for browser fingerprint emulation.

Variant Description
Linux Linux operating system fingerprint and profile emulation.
Mac macOS fingerprint and browser environment emulation.
Windows Windows operating system fingerprint emulation.
Android Android device fingerprint and browser emulation.

Example:

agent_os = PyAgentOs.Mac

Testing

  1. maturin develop
  2. pytest -s test_spider_fingerprint.py

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

spider_fingerprint_py-0.0.8.tar.gz (20.2 kB view details)

Uploaded Source

Built Distributions

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

spider_fingerprint_py-0.0.8-cp313-cp313-macosx_11_0_arm64.whl (255.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

spider_fingerprint_py-0.0.8-cp39-cp39-win_amd64.whl (198.1 kB view details)

Uploaded CPython 3.9Windows x86-64

spider_fingerprint_py-0.0.8-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (295.2 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file spider_fingerprint_py-0.0.8.tar.gz.

File metadata

File hashes

Hashes for spider_fingerprint_py-0.0.8.tar.gz
Algorithm Hash digest
SHA256 303f3f941e595e8b35bea32a6624ae4530312d5f2662fd7ddccf12bb8f64984a
MD5 976666f7af69341882bb06a98a60483a
BLAKE2b-256 21acc8f04b08e35f3e40ce1f4eef272e62fbc1de1ffb810b5943d83d108497ae

See more details on using hashes here.

File details

Details for the file spider_fingerprint_py-0.0.8-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spider_fingerprint_py-0.0.8-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9c7e078c5c0357f172560e0f930c86c157288d48487757899dca3fabdf3df8c5
MD5 b8f6a48ed0a1ea976eaf7558f6ca2ae1
BLAKE2b-256 effbcc3160b82f07766ed332b422703aa271c186d8375f8674bab83b81a68592

See more details on using hashes here.

File details

Details for the file spider_fingerprint_py-0.0.8-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for spider_fingerprint_py-0.0.8-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 7ebc624f9e85f530906a774435d72668e27674844ef371be2bd2b2472e2fba95
MD5 eded9bc91f176691ed6ff071db00ba0f
BLAKE2b-256 94cb067fc6cd0c13e61680b2c80690b5829f876c4d26e94f151a548e72dc1bd8

See more details on using hashes here.

File details

Details for the file spider_fingerprint_py-0.0.8-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for spider_fingerprint_py-0.0.8-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 974b3c59d6b58af601b32b4487686d0c1ae3043913fc481657070026811d3271
MD5 da2c4c3d43d53c75665f0265da136446
BLAKE2b-256 39ac2bbe151a60089257561a1907b9d1756988c0ec6f5f5173980010a7a02e0f

See more details on using hashes here.

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