Skip to main content

Python module to generate realistic browsers window size.

Project description

fakewindowsize banner

fakewindowsize

Python module to generate realistic browsers window size.

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

DeepWiki https://deepwiki.com/carlosplanchon/fakewindowsize.

Features

  • 📊 Real-world data: Uses current browser resolution statistics from StatCounter (2025 data)
  • 🎲 Weighted random selection: More common resolutions are more likely to be returned
  • 💾 Smart caching: Automatically caches data locally to minimize network requests
  • 📱 Multi-device support: Includes desktop, tablet, and mobile resolutions
  • 🔒 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)

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 cumulative distribution
  3. Uses weighted random selection to pick resolutions based on real-world usage
  4. Caches data locally (~/.fakescreensize.json) to reduce API calls
  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.

Documentation

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

fakewindowsize-0.6.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

fakewindowsize-0.6-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file fakewindowsize-0.6.tar.gz.

File metadata

  • Download URL: fakewindowsize-0.6.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for fakewindowsize-0.6.tar.gz
Algorithm Hash digest
SHA256 c0e8e31ef08be08342d608ddd3dc6c6927bcff86f3d1fd0127b2373e3d725163
MD5 fd90c08a5b885422051ae1470d61b858
BLAKE2b-256 de8c6892b06e850e5185db49e73e585718f0725babd457cd3dbcd88973d9f202

See more details on using hashes here.

File details

Details for the file fakewindowsize-0.6-py3-none-any.whl.

File metadata

  • Download URL: fakewindowsize-0.6-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for fakewindowsize-0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 bc51e8aaea38e017849abc0f6d7fe652a39867d69f63398f8f9109b8b62fdf2a
MD5 b929a82e12fea802c7b846975ffdf163
BLAKE2b-256 cdb5f0124a7cd0200501269f887e1d4b17cdcfb25cb6f2636cf9b661b48b6e95

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