Skip to content

Commit 5fb1ad0

Browse files
authored
Drop Python 3.8 support (#41)
1 parent cea0fd5 commit 5fb1ad0

File tree

11 files changed

+155
-594
lines changed

11 files changed

+155
-594
lines changed

.github/workflows/precommits.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
strategy:
1616
matrix:
17-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
17+
python-version: ["3.9", "3.10", "3.11", "3.12"]
1818

1919
steps:
2020
- name: Checkout Repository

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,7 @@ venv.bak/
104104
.mypy_cache/
105105

106106
tests/e2e/screenshots
107-
.DS_Store
107+
.DS_Store
108+
109+
# claude
110+
.claude

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## 1.2.0
5+
- Drop Python 3.8 support
6+
47
## 1.1.3
58
- Updated dependencies to fix security vulnerabilities
69

playwright_stealth/core/_stealth_config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import json
22
from dataclasses import dataclass
3-
from typing import Dict, Tuple, Optional
3+
from typing import Optional
44
import os
55
from playwright_stealth.properties import Properties, BrowserType
66

@@ -12,7 +12,7 @@ def from_file(name) -> str:
1212
return f.read()
1313

1414

15-
SCRIPTS: Dict[str, str] = {
15+
SCRIPTS: dict[str, str] = {
1616
"chrome_csi": from_file("chrome.csi.js"),
1717
"chrome_app": from_file("chrome.app.js"),
1818
"chrome_runtime": from_file("chrome.runtime.js"),
@@ -76,7 +76,7 @@ def enabled_scripts():
7676
nav_vendor: str = "Google Inc."
7777
nav_user_agent: str = None
7878
nav_platform: str = None
79-
languages: Tuple[str, str] = ("en-US", "en")
79+
languages: tuple[str, str] = ("en-US", "en")
8080
run_on_insecure_origins: Optional[bool] = None
8181

8282
def enabled_scripts(self, properties: Properties):

playwright_stealth/properties/_header_properties.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from dataclasses import dataclass
2-
from typing import List
32

43

54
@dataclass
@@ -23,7 +22,7 @@ class HeaderProperties:
2322

2423
def __init__(
2524
self,
26-
brands: List[dict],
25+
brands: list[dict],
2726
dnt: str,
2827
client_hint_headers_enabled: bool = True,
2928
**kwargs,
@@ -61,7 +60,7 @@ def _generate_sec_ch_ua_platform(self) -> str:
6160
else:
6261
return "Unknown"
6362

64-
def _generate_sec_ch_ua(self, brands: List[dict]) -> str:
63+
def _generate_sec_ch_ua(self, brands: list[dict]) -> str:
6564
"""Generates the Sec_Ch_Ua based brands generated"""
6665
merged_brands = "".join([f'"{brand["brand"]}";v="{brand["version"]}",' for brand in brands])
6766
return merged_brands

playwright_stealth/properties/_navigator_properties.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from dataclasses import dataclass
2-
from typing import List
32

43

54
@dataclass
@@ -9,17 +8,17 @@ class NavigatorProperties:
98
userAgent: str
109
platform: str
1110
language: str
12-
languages: List[str]
11+
languages: list[str]
1312
appVersion: str
1413
vendor: str
1514
deviceMemory: int
1615
hardwareConcurrency: int
1716
maxTouchPoints: int
1817
doNotTrack: str
19-
brands: List[dict]
18+
brands: list[dict]
2019
mobile: bool
2120

22-
def __init__(self, brands: List[dict], dnt: str, **kwargs):
21+
def __init__(self, brands: list[dict], dnt: str, **kwargs):
2322
self.userAgent = kwargs["User-Agent"]
2423

2524
# Shared properties
@@ -55,7 +54,7 @@ def _generate_language(self) -> str:
5554

5655
return "en-US"
5756

58-
def _generate_languages(self, accept_language: str) -> List[str]:
57+
def _generate_languages(self, accept_language: str) -> list[str]:
5958
"""Generates the languages based on the accept language."""
6059

6160
languages_with_quality = accept_language.split(",")

playwright_stealth/properties/_viewport_properties.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from dataclasses import dataclass
2-
from typing import Tuple
32
import random
43

54

@@ -19,13 +18,13 @@ def __init__(self, **kwargs):
1918
self.outerWidth, self.outerHeight = self._generate_outer_dimensions()
2019
self.innerWidth, self.innerHeight = self._generate_inner_dimensions()
2120

22-
def _generate_viewport_dimensions(self) -> Tuple[int, int]:
21+
def _generate_viewport_dimensions(self) -> tuple[int, int]:
2322
return 1920 + random.randint(-100, 100), 1080 + random.randint(-100, 100)
2423

25-
def _generate_outer_dimensions(self) -> Tuple[int, int]:
24+
def _generate_outer_dimensions(self) -> tuple[int, int]:
2625
return self.width, self.height
2726

28-
def _generate_inner_dimensions(self) -> Tuple[int, int]:
27+
def _generate_inner_dimensions(self) -> tuple[int, int]:
2928
return (
3029
self.width - random.randint(0, 20),
3130
self.height - random.randint(0, 20),

poetry.lock

Lines changed: 131 additions & 571 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tool.poetry]
22
name = "tf-playwright-stealth"
33
packages = [{ include = "playwright_stealth" }]
4-
version = "1.1.3"
4+
version = "1.2.0"
55
description = "Makes playwright stealthy like a ninja!"
66
authors = []
77
homepage = "https://www.agentql.com/"
@@ -10,7 +10,7 @@ license = "MIT"
1010
readme = "README.md"
1111

1212
[tool.poetry.dependencies]
13-
python = "^3.8"
13+
python = "^3.9"
1414
playwright = "^1"
1515
fake-http-header = "^0.3.5"
1616

tests/e2e/configs.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from typing import List
21
from pydantic import BaseModel
32

43
from tests.utils import from_file
@@ -28,7 +27,7 @@ def __hash__(self):
2827

2928
class MultipleScriptConfig(BaseModel):
3029
name: str
31-
script: List[str]
30+
script: list[str]
3231
query: str
3332
url: str
3433

0 commit comments

Comments
 (0)