Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FingerprintGenerator().generate not consistent #22

Open
Pijukatel opened this issue Jan 24, 2025 · 1 comment
Open

FingerprintGenerator().generate not consistent #22

Pijukatel opened this issue Jan 24, 2025 · 1 comment

Comments

@Pijukatel
Copy link
Contributor

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
@mengGit66
Copy link

mengGit66 commented Jan 24, 2025

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

Image

run example

from browserforge.fingerprints import FingerprintGenerator
fingerprints = FingerprintGenerator()
fingerprints.generate()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants