Skip to content

HRequests Integration

HRequests

This tutorial uses the powerful Python HTTP library HRequests.

Step 1: Install the library

shell
pip install hrequests[all]

Step 2: Retrieve CA certificate and project token

Certificate

  1. Open Scrapoxy User interface, and go to the project Settings;
  2. Enable Keep the same proxy with cookie injection;
  3. Remember the project token.

Step 3: Create and run the script

Create a file name hrequests.py with the following content:

python
import hrequests

proxy = "http://USERNAME:PASSWORD@localhost:8888"

session = hrequests.Session()

r = session.get(
    "https://fingerprint.scrapoxy.io",
    proxy=proxy,
    verify=False
)

session.close()

print("proxy instance:", r.headers["x-scrapoxy-proxyname"])

print(r.json())

Replace USERNAME and PASSWORD by the credentials you copied earlier.

INFO

All requests made in the same session will use the same proxy instance.

Run the script:

shell
python hrequests.py

Released under the MIT License.