Skip to content
intermediate

How to Set Up IPRoyal SOCKS5 Proxies on Windows for Web Scraping

A step-by-step guide to configuring IPRoyal's SOCKS5 proxies on Windows for efficient and anonymous web scraping, covering credential setup, browser configuration, and Python integration.

Windows SOCKS5 Web Scraping

Overview

Web scraping often requires rotating IP addresses to avoid rate limits and blocks. SOCKS5 proxies provide a flexible way to route traffic at the socket level, supporting both TCP and UDP. IPRoyal offers residential, datacenter, and ISP proxies with SOCKS5 support, along with a pool of 32M+ IPs and pay-as-you-go or flat monthly billing. This tutorial shows you how to configure IPRoyal SOCKS5 proxies on Windows for web scraping tasks. We'll cover obtaining credentials, setting up a browser, and using Python with the requests library. The steps are vendor-neutral and can be adapted to other providers.

Steps

  1. Sign up and obtain proxy credentials
    Create an account with IPRoyal (or your chosen provider). Navigate to the dashboard and locate your SOCKS5 proxy credentials. You will typically receive:

    • Proxy host (e.g., geo.iproyal.com or an IP address)
    • Port (e.g., 12345)
    • Username and password
    • Optionally, a list of IPs or a rotating endpoint.

    Note: IPRoyal supports both HTTP and SOCKS5; ensure you select SOCKS5 when generating credentials.

  2. Test your proxy with a simple cURL command
    Open Command Prompt or PowerShell and run:

    curl -x socks5://username:password@host:port https://httpbin.org/ip
    

    Replace username, password, host, and port with your credentials. If successful, the response will show the proxy's IP address.

  3. Configure a web browser (Firefox) for manual proxy use

    • Open Firefox and go to about:preferences.
    • Scroll to the bottom and click "Settings..." under Network Settings.
    • Select "Manual proxy configuration".
    • In the SOCKS Host field, enter your proxy host and port.
    • Choose "SOCKS v5".
    • Check "Proxy DNS when using SOCKS v5" to prevent DNS leaks.
    • If your proxy requires authentication, Firefox will prompt for username and password on first use. Alternatively, use an extension like FoxyProxy for easier management.
  4. Set up Python for scraping with SOCKS5
    Install the requests and requests[socks] libraries:

    pip install requests requests[socks]
    

    Use the following code to send a request through the proxy:

    import requests
    
    proxies = {
        'http': 'socks5://username:password@host:port',
        'https': 'socks5://username:password@host:port'
    }
    response = requests.get('https://httpbin.org/ip', proxies=proxies)
    print(response.text)
    

    This will route your request through the SOCKS5 proxy.

  5. Implement IP rotation
    For large-scale scraping, you'll want to rotate IPs. IPRoyal may provide a rotating endpoint or a list of individual IPs; check your dashboard. With a rotating endpoint, each request (or session) can use a different IP. For example, using a session with a rotating proxy:

    import requests
    from itertools import cycle
    
    proxy_list = [
        'socks5://user:pass@host1:port1',
        'socks5://user:pass@host2:port2',
        # ...
    ]
    proxy_pool = cycle(proxy_list)
    
    for i in range(10):
        proxy = next(proxy_pool)
        try:
            response = requests.get('https://httpbin.org/ip', proxies={'http': proxy, 'https': proxy}, timeout=10)
            print(response.json())
        except:
            print("Proxy failed")
    

    Adjust according to your provider's rotation method.

  6. Handle errors and respect robots.txt
    Always implement error handling, retries, and delays. Respect the target site's robots.txt and terms of service. Using proxies does not exempt you from legal and ethical scraping practices.

  7. Monitor and scale
    As your scraping needs grow, consider using a proxy manager or rotating proxy service. IPRoyal offers pay-as-you-go and flat monthly plans to suit different volumes. Monitor your usage and success rates to optimize.