Code Sample

Explore Rapidproxy code samples for using residential proxies with cURL, Python, Node.js, Puppeteer, and Java. Learn how to configure proxy authentication and integrate proxies into your applications.

This page provides ready-to-use code examples for integrating Rapidproxy proxies in various programming languages and tools. You’ll find sample usage for both Dynamic (Rotating) Residential Proxiesarrow-up-right and Static Residential Proxiesarrow-up-right with common authentication methods.


1. General Usage & How to Read These Examples

Rapidproxy supports multiple proxy authentication methods including:

You’ll see examples using both methods where applicable.

Note: Replace placeholder values like YOUR_PROXY_HOST, YOUR_PORT, YOUR_USERNAME, YOUR_PASSWORD with real values from your Rapidproxy dashboard.


2. cURL Examples

Dynamic Residential Proxy — Username & Password

curl -x http://YOUR_USERNAME:YOUR_PASSWORD@YOUR_PROXY_HOST:YOUR_PORT https://example.com

Dynamic Residential Proxy — IP Whitelist (no credentials)

curl -x http://YOUR_PROXY_HOST:YOUR_PORT https://example.com

(Ensure your current IP is whitelisted before using this request.)

Static Residential Proxy


3. Python Example (requests library)

With Username & Password Auth

With IP Whitelisting Only


4. Node.js Example (axios)

With Username & Password Auth

With IP Whitelisting Only


5. Puppeteer Example (Headless Browser)

With Username & Password Auth


6. Java Example (Apache HttpClient)

With Username & Password Auth


7. Tips for Using Proxies in Code

Protocol Support

  • HTTP and HTTPS are both supported

  • SOCKS5 can be used if your client supports the protocol

Sticky Sessions (Dynamic Proxies)

If you configured a sticky session when generating proxy credentials:

  • Each request within the session will use the same IP

  • Useful for login, form submission, and session-based automation

IP Whitelist

If using IP whitelisting:

  • Confirm the source IP of your application or server is added to the whitelist

  • Requests from non-whitelisted IPs will be blocked


8. Troubleshooting

If your code receives proxy errors:

  • Double-check proxy host/port values

  • Ensure credentials are correct (for username/password authentication)

  • Verify your IP is whitelisted (if applicable)

  • Check that your tool/client supports the proxy protocol you are using

If issues persist, contact support:


9. Security Notes

  • Never share credentials publicly

  • Store proxy usernames & passwords in secure configuration or environment variables

  • Rotate credentials if compromised

Last updated