Skip to content

Instantly share code, notes, and snippets.

@s3rgeym
Created August 17, 2024 12:37
Show Gist options
  • Save s3rgeym/339941470b30a3f0c870bd05ef138316 to your computer and use it in GitHub Desktop.
Save s3rgeym/339941470b30a3f0c870bd05ef138316 to your computer and use it in GitHub Desktop.
import random
def fake_chrome_useragent() -> str:
chrome_version = random.randint(112, 127)
webkit_version = "537.36"
platform = random.choice(
[
"Windows NT 10.0; Win64; x64",
"Macintosh; Intel Mac OS X 10_15_7",
"X11; Linux x86_64",
]
)
return (
f"Mozilla/5.0 ({platform}) AppleWebKit/{webkit_version} "
f"(KHTML, like Gecko) Chrome/{chrome_version}.0.0.0 "
f"Safari/{webkit_version}"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment