How to configure a proxy server with Python - StableProxy

Published

Jun 28th, 2025

Topic

Manual

Reading time

10 mins

Blog
Author

Author

StableProxy

Python and Proxy

Requests is a Python library known for its simplicity and prevalence in handling HTTP/1.1 requests. Its popularity among developers is explained by millions of downloads every month. The library simplifies the management of HTTP requests and responses, eliminating the need to manually enter request strings into the URL.
The importance of integrating proxy servers with libraries for scraping or web requests is undeniable. By applying proxy servers, you will avoid IP address blocks of target sites and reduce the risk of disclosing your own IP address.

Installing Requests is not difficult. Below are details on how to include a proxy in your code.

import requests

# URL to be scanned

url = 'https://www.example.com'  # replace with the URL of the desired site

# Setting up a proxy with authorization

proxy_host = 'de-1.stableproxy.com'

proxy_port = 11001

proxy_login = '2TYt4bmrOn_0'

proxy_password = '2oRTH88IShd4'

proxy = f'http://:@:'

proxies = {

    'http': proxy,

    'https': proxy

}

# Send a GET request using a proxy

response = requests.get(url, proxies=proxies)

# Check the success of the request

if response.status_code == 200:

    # Process the content of the response

    print(response.text)

else:

    print('Request failed with status code:', response.status_code)

NOTE: Please replace with your real proxy server credentials so that the code can work with your proxy server login and password.
 
That's it! The integration of proxy servers into libraries for scraping or web requests is crucial. By setting them up in Python code, you can safely start your web scraping projects without fear of IP blocking or geographic restrictions.