Python module to generate realistic screen resolutions from real-world StatCounter data.
Project description
fakewindowsize
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,regionanddevicemix - 🔒 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 (default30;Noneto never expire).request_timeout: seconds before an HTTP request times out (default30).
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
- Fetches screen resolution statistics from StatCounter's global database
- Converts market share percentages into a cumulative distribution
- Uses weighted random selection to pick resolutions based on real-world usage
- Caches data locally (
~/.fakewindowsize-<device>-<region>-<year>.json) to reduce network requests - 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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fakewindowsize-0.8.2.tar.gz.
File metadata
- Download URL: fakewindowsize-0.8.2.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6de82f43e160e16cb1f74f040a1b1a72b0417a156ef98d518ff38701825e2db5
|
|
| MD5 |
a62974ae50d0b24db87ce117eb228a48
|
|
| BLAKE2b-256 |
bd1935c5c0e0403157dabd07d15666360d90dcd7cf9d591b513c4dca2ebad375
|
Provenance
The following attestation bundles were made for fakewindowsize-0.8.2.tar.gz:
Publisher:
publish.yml on carlosplanchon/fakewindowsize
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fakewindowsize-0.8.2.tar.gz -
Subject digest:
6de82f43e160e16cb1f74f040a1b1a72b0417a156ef98d518ff38701825e2db5 - Sigstore transparency entry: 2064751131
- Sigstore integration time:
-
Permalink:
carlosplanchon/fakewindowsize@082d17a54e294495e30c394d0bbbe2cd1407334d -
Branch / Tag:
refs/tags/v0.8.2 - Owner: https://github.com/carlosplanchon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@082d17a54e294495e30c394d0bbbe2cd1407334d -
Trigger Event:
push
-
Statement type:
File details
Details for the file fakewindowsize-0.8.2-py3-none-any.whl.
File metadata
- Download URL: fakewindowsize-0.8.2-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57a2582e5d1234dccc264d911f3b7e0a7a546ae014d23e34b169c26f5d5678d9
|
|
| MD5 |
25b7f391e002662557cf7b4e9423be66
|
|
| BLAKE2b-256 |
5e0e082f42ab55fd42268af265fed15c6b129a978c5fc3eba489928a11a0f0c6
|
Provenance
The following attestation bundles were made for fakewindowsize-0.8.2-py3-none-any.whl:
Publisher:
publish.yml on carlosplanchon/fakewindowsize
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fakewindowsize-0.8.2-py3-none-any.whl -
Subject digest:
57a2582e5d1234dccc264d911f3b7e0a7a546ae014d23e34b169c26f5d5678d9 - Sigstore transparency entry: 2064751136
- Sigstore integration time:
-
Permalink:
carlosplanchon/fakewindowsize@082d17a54e294495e30c394d0bbbe2cd1407334d -
Branch / Tag:
refs/tags/v0.8.2 - Owner: https://github.com/carlosplanchon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@082d17a54e294495e30c394d0bbbe2cd1407334d -
Trigger Event:
push
-
Statement type: