Skip to main content
fakewindowsize banner

fakewindowsize

CI PyPI version Python versions License: MIT DeepWiki

Python module to generate realistic screen resolutions.

Generate random but statistically accurate screen resolutions based on real-world usage data from StatCounter. Perfect for web scraping, testing, and generating realistic browser fingerprints.

Note on terminology: the data source is StatCounter's screen resolution stats (i.e. screen.width × screen.height, the physical display size), not the browser viewport / window inner size (window.innerWidth). For most fingerprinting use cases the screen resolution is exactly what you want.

Features

  • 📊 Real-world data: Uses screen resolution statistics from StatCounter (defaults to the previous, complete year)
  • 🎲 Weighted random selection: More common resolutions are more likely to be returned
  • 💾 Smart caching: Caches data locally (with a TTL) to minimize network requests
  • 📱 Multi-device support: Includes desktop, tablet, and mobile resolutions
  • 🌍 Configurable: Choose the year, region and device mix
  • 🔒 Proxy support: Configure HTTP proxies for data fetching

Installation

pip install fakewindowsize

Or with uv:

uv add fakewindowsize

Usage

Basic usage

import fakewindowsize

f = fakewindowsize.FakeWindowSize()

# Get a random, statistically realistic window size
width, height = f.get_random_window_size()
print(f"{width}x{height}")  # e.g., (1920, 1080)

Choosing year / region / device

# US desktop resolutions from the 2024 dataset
f = fakewindowsize.FakeWindowSize(year=2024, region="us", device="desktop")
width, height = f.get_random_window_size()
  • year: StatCounter yearly dataset (defaults to the previous calendar year, which is always complete).
  • region: StatCounter region code (ww, us, eu, ...).
  • device: +-joined device types (desktop+tablet+mobile, desktop, mobile, ...).
  • cache_ttl_days: how long the local cache stays fresh (default 30; None to never expire).
  • request_timeout: seconds before an HTTP request times out (default 30).

Each parameter combination is cached in its own file, so different regions/years never clobber each other.

With proxy support

f = fakewindowsize.FakeWindowSize()

proxies = {
    'http': 'http://proxy.example.com:8080',
    'https': 'http://proxy.example.com:8080',
}

data = f.scrape_window_size_dict(request_proxies=proxies)

How it works

  1. Fetches screen resolution statistics from StatCounter's global database
  2. Converts market share percentages into a cumulative distribution
  3. Uses weighted random selection to pick resolutions based on real-world usage
  4. Caches data locally (~/.fakewindowsize-<device>-<region>-<year>.json) to reduce network requests
  5. Returns resolution as a tuple of (width, height)

Data source

Screen resolution data is sourced from StatCounter Global Stats, which tracks browser usage across desktop, tablet, and mobile devices worldwide.

Metadata

Release files for fakewindowsize 0.8.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fakewindowsize 0.8.2
File Size Uploaded Provenance
fakewindowsize-0.8.2.tar.gz 10.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fakewindowsize 0.8.2
File Interpreter ABI Platform
fakewindowsize-0.8.2-py3-none-any.whl Python 3 none any Details

Total release size: 17.6 kB

Release files / fakewindowsize-0.8.2.tar.gz

Download URL fakewindowsize-0.8.2.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6de82f43e160e16cb1f74f040a1b1a72b0417a156ef98d518ff38701825e2db5
BLAKE2b-256 checksum
How to use checksums
bd1935c5c0e0403157dabd07d15666360d90dcd7cf9d591b513c4dca2ebad375
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 4, 2026.

Transparency log

Release files / fakewindowsize-0.8.2-py3-none-any.whl

Download URL fakewindowsize-0.8.2-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
57a2582e5d1234dccc264d911f3b7e0a7a546ae014d23e34b169c26f5d5678d9
BLAKE2b-256 checksum
How to use checksums
5e0e082f42ab55fd42268af265fed15c6b129a978c5fc3eba489928a11a0f0c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 4, 2026.

Transparency log

Security for fakewindowsize 0.8.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fakewindowsize-0.8.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page