Python, curl and Playwright examples for turning a proxy request into useful records
Get started with ProxyLane · Pricing · Agent setup skill
- Published by ProxyLane. Source code and setup instructions live together in this public repository.
- Automated tests. Authentication, rejected responses and SEO validation run against local fixtures on every push. No paid proxy traffic is needed.
- Credentials stay out of the repository. Examples use environment variables and keep credentials out of command-line arguments and logs.
- Reproducible sample results. The included fixture has four rows: two accepted and two rejected. These demonstrate the code, not network performance.
Use your ProxyLane connection details with these examples. Keep the same scripts and acceptance rules when comparing providers. The examples also work with compatible proxy services.
| Goal | Start here | Result |
|---|---|---|
| Collect a JSON document through a proxy | Python + curl | Accepted records in JSON and CSV |
| Use a proxy in a browser | Playwright | Validated records in JSON |
| Check your SEO collector output | SEO observations | Accepted observations and cost summary |
| Compare providers on the same job | Migration worksheet | A CSV for your own measurements |
Requires Python 3.10+. No account or network requests needed.
git clone https://github.com/ProxyLane/proxy-examples.git
cd proxy-examples
python3 evaluate-seo.py seo-example.csv --output seo-demo.jsonExpected: 4 observations, 2 accepted, 2 rejected. The fixture contains invented costs to demonstrate the calculation. It is not a provider benchmark.
- Create your ProxyLane account.
- Obtain an active proxy connection and copy its server, port and credentials from your dashboard. Registration alone does not supply traffic.
- Use the prompts below to load credentials into your shell. They are not saved in this repository.
.env.exampledocuments the variable names; scripts do not load it automatically.
Use Bash for these prompts. Paste credentials only at the hidden prompts, not into commands or Git files.
Requires Python 3.10+ and curl 8.4+. From the repository directory:
read -r -s -p 'Proxy URL (scheme://user:password@host:port): ' PROXY_URL; printf '\n'
export PROXY_URL
python3 collect.py \
--target https://raw.githubusercontent.com/ProxyLane/proxy-examples/main/fixture.json \
--output result.json
unset PROXY_URLPercent-encode special characters in the proxy URL username and password. The script sends credentials to curl through stdin, not command-line arguments.
The included JSON fixture has four rows: 2 accepted and 2 rejected. Inspect result.json and result.csv. Replace the target with your own permitted JSON endpoint and adapt the acceptance rule to its schema.
Read the scraping guide · View Python source
Requires Node 20+ and the pinned Playwright dependency.
npm ci
npx playwright install chromium
read -r -p 'Proxy server (scheme://host:port): ' PROXY_SERVER
read -r -s -p 'Proxy username: ' PROXY_USERNAME; printf '\n'
read -r -s -p 'Proxy password: ' PROXY_PASSWORD; printf '\n'
export PROXY_SERVER PROXY_USERNAME PROXY_PASSWORD
export TARGET_URL=https://raw.githubusercontent.com/ProxyLane/proxy-examples/main/fixture.json
npm run collect
unset PROXY_SERVER PROXY_USERNAME PROXY_PASSWORD TARGET_URLInspect browser-result.json: expected 2 accepted, 2 rejected. For an installed Google Chrome, set BROWSER_CHANNEL=chrome and skip the browser download. For IP allowlisting, leave both credential prompts empty.
This example reads one JSON document through a browser. It does not scrape arbitrary websites; it blocks redirects and subresources. HTTP(S) proxy authentication is supported; authenticated SOCKS is not.
Read the Playwright guide · View browser source
Fill seo-observations.csv with observations from your collector, then run:
python3 evaluate-seo.py seo-observations.csv --output seo-result.jsonChecks include location matching, search depth, challenges and duplicates. A missing cost stays unknown. The validator checks supplied observations; it does not fetch search results or independently verify geography.
Read the SEO monitoring guide · View validator
Use migration-sheet.csv to compare providers with the same target, region, session policy and acceptance rule. Record accepted records and actual billed traffic. Run the collector separately with each provider and use different output filenames.
Compare Bright Data alternatives
A successful run proves that this fixture passed your proxy connection and acceptance rule. Response bytes are not provider-billed traffic. Samples were produced with a local test proxy, not the ProxyLane network. No benchmark, geographic coverage or reliability claim is implied.
Outputs refuse overwrites. Choose a new filename for another run. Use permitted targets and keep credentials and real records private. See usage details and exit codes.
python3 -m unittest discover -s tests -p 'test_*.py'Tests use a local authenticated proxy and synthetic records; no paid proxy traffic is required.
Playwright bandwidth experiment: paired resource-loading measurements on the Books to Scrape catalogue, with runnable code, record validation, raw observations and chart generation. The research package documents its own live-run provenance separately from the synthetic examples above.
MIT. Built by ProxyLane.
