Skip to main content

t-proxy-toolkit

A wrapper around rpaframework selenium driver to enable proxy usage with Oxylabs. You can also use this tool to start a request session using Oxylabs.

Installation

Install using pip:

pip install t-proxy-toolkit

Usage

Browser Usage

Instead of creating a selenium object directly from rpaframework, use this library's chrome or firefox methods. You can optionally provide initialization preferences or options for the browser as a dictionary.

By default, the browser will be assigned a custom UserAgent using the fake-useragent package with these settings:

from fake_useragent import UserAgent

user_agent = UserAgent(os="windows", min_percentage=1.3)

# For chrome
user_agent.chrome

# For firefox
user_agent.firefox

Warning: Headless mode cannot be used when installing browser extensions

Basic usage example:

from t_proxy import BrowserProxy
from RPA.Browser.Selenium import Selenium

browser_proxy = BrowserProxy()

# Proxy credentials
user = "your_username"
password = "your_password" 
host = "proxy.host.com"
port = "12345"

# Initialize browsers - type hints added for better IDE support
firefox: Selenium = browser_proxy.firefox(user, password, host, port)
chrome: Selenium = browser_proxy.chrome(user, password, host, port)

You can create a new user for metrics and usage tracking in the Oxylabs dashboard.

Browser Configuration

Firefox Preferences

You can configure Firefox by passing a preferences dictionary. Reference the following Mozilla documentation for available preferences:

Example:

prefs = {
    "download.default_directory": "/path/to/downloads",
    "browser.download.folderList": 2
}

firefox: Selenium = browser_proxy.firefox(user, password, host, port, prefs)

Chrome Options

For Chrome, you can pass selenium ChromeOptions. Reference these resources for available options:

Example:

from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")

chrome: Selenium = browser_proxy.chrome(user, password, host, port, options)

Requests Usage

Use Oxylabs proxy servers with Python requests. The proxy behavior depends on the port:

  • Port 8000: Returns a different IP for each request
  • Ports 8001-8010: Uses a fixed IP for all requests

IPs can be managed through the Oxylabs dashboard.

Example:

from t_proxy import RequestsProxy
from requests import Session

# Proxy configuration
creds = {
    "login": "your_username",
    "password": "your_password",
    "port": "8000"  # or 8001-8010 for fixed IP
}

requests_proxy = RequestsProxy()
session: Session = requests_proxy.session(creds)

# Make requests
response = session.get("https://api.ipify.org?format=json")
print(response.json())

Metadata

Release files for t-proxy-toolkit 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for t-proxy-toolkit 0.2.1
File Size Uploaded
t_proxy_toolkit-0.2.1.tar.gz 552.7 kB Details

Release files / t_proxy_toolkit-0.2.1.tar.gz

Download URL t_proxy_toolkit-0.2.1.tar.gz
Size 552.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3d861fc6372c2f1fbe22324e6f7447df636696b08cb882a2867594b84cf09929
BLAKE2b-256 checksum
How to use checksums
3b1aebce35bc1bb91d6a05f1a6e470df0c8122d385e9c8cb1555a89a84f443f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release history Release notifications | RSS feed

This release

0.2.1 This release

1 release file

0.2.0

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page