browserforge icon indicating copy to clipboard operation
browserforge copied to clipboard

Making a separate browserforge-injector package

Open daijro opened this issue 1 year ago • 3 comments

I'm considering separating the the browserforge.injectors submodule into an independently updated browserforge-injector library on pypi in order to:

  1. Make the injector submodules and dependencies optional to those who do not use BrowserForge for controlled browsing
  2. Focus on more advanced integration of Playwright/Pyppeteer fingerprinting workarounds that may be out of scope of the base browserforge package
  3. Make the base browserforge package lighter

Does anyone have any thoughts on this? Let me know!

daijro avatar Apr 08 '24 21:04 daijro

@daijro is it possible to inject generated fingerprint into hrequests or requests

Ehsan-U avatar Jul 05 '24 04:07 Ehsan-U

@daijro is it possible to inject generated fingerprint into hrequests or requests

Hi, BrowserForge headers can be easily set to a requests session (see here).

Here are some examples:

Using Requests

import requests
from browserforge.headers import HeaderGenerator
# Create the header generator
headers = HeaderGenerator()
# Build the requests session
session = requests.Session()
session.headers = headers.generate()  # Set the session headers
# Send a request
resp = session.get('https://example.com')
print(resp.status_code)

If you're using Requests, you might also want to look into using Hazetunnel to spoof the TLS fingerprint to match the User-Agent browser like hrequests does.

Using Hrequests

import hrequests
from browserforge.headers import HeaderGenerator
# Create a chrome header generator
headers = HeaderGenerator(browser='chrome')
# Build a chrome hrequests session
session = hrequests.Session(browser='chrome')
session.headers = headers.generate()  # Set the session headers
# Send a request
resp = session.get('https://example.com')
print(resp.status_code)

Note: Browserforge will be integrated into hrequests in an upcoming update.

daijro avatar Jul 05 '24 06:07 daijro

Hey @daijro I can try and help with this task if you still interested.

Question: Is there a specific reason for locking Browserforge to version 1.1.2 in hrequests version 0.9.2?

vitalis avatar Mar 03 '25 00:03 vitalis