FingerprintGenerator().generate not consistent
Hi,
when testing FingerprintGenerator I have seen that it can fail to generate fingerprints with error:
"ValueError: Cannot generate headers. User-Agent may be invalid, or screen constraints are too restrictive."
The problem is that this error can be thrown on "good" inputs that the generator previously successfully generated fingeprints for.
To reproduce, please start following stress test:
import pytest
from browserforge.fingerprints import Screen, FingerprintGenerator
@pytest.mark.parametrize("_", range(100))
def test_stress_fingerprint_generator_some_options(_) -> None:
"""Test that generator can work consistently."""
fingerprint = FingerprintGenerator().generate(
mock_webrtc = True,
screen=Screen(min_width=500.0, max_width=None, min_height=None, max_height=None),
strict=True)
assert fingerprint.mockWebRTC is True
assert fingerprint.screen.availWidth > 500
Hello I would like to inquire if you have run the example provided by the blogger directly after installing pip. Are there any other operations,
I am currently running an error message ,Could you please provide guidance? Thank you very much
run example
from browserforge.fingerprints import FingerprintGenerator fingerprints = FingerprintGenerator() fingerprints.generate()