{"id":282,"date":"2026-11-12T15:30:00","date_gmt":"2026-11-12T10:00:00","guid":{"rendered":"https:\/\/proxykite.com\/blog\/?p=282"},"modified":"2026-11-12T15:30:00","modified_gmt":"2026-11-12T10:00:00","slug":"python-requests-proxy","status":"publish","type":"post","link":"https:\/\/proxykite.com\/blog\/python-requests-proxy\/","title":{"rendered":"Python Requests Proxy: HTTP, SOCKS5 and Rotation"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A python requests proxy lets you send HTTP and HTTPS traffic through a chosen gateway while keeping your application code almost unchanged. The details that usually cause failures are the <code>proxies<\/code> dictionary, URL-encoded credentials, SOCKS5 DNS behaviour, missing timeouts, and rotating an IP without retrying a write request.<\/p>\n\n\n\n<aside class=\"ap-card\" aria-label=\"ProxyKite per-dongle licence\">\n<span class=\"ap-card__badge\">Our pick<\/span>\n<div class=\"ap-card__body\"><p class=\"ap-card__name\">ProxyKite per-dongle licence<\/p><p class=\"ap-card__best\">Best for anyone turning their own 4G\/LTE dongles + SIMs into HTTP\/SOCKS5 mobile proxies, from 1 dongle to hundreds<\/p><ul class=\"ap-card__features\"><li>Every dongle becomes an HTTP + SOCKS5 proxy on a public port of our cloud router \u2014 no static IP or port forwarding, works behind CGNAT<\/li><li>IP rotation on demand, by rotation link, or on a timer from 60 s to 7 days (sticky option); returns old + new IP<\/li><li>One-line installer on a Raspberry Pi \/ Linux box; Huawei E3372 HiLink is the reference stick<\/li><li>SIM inbox for carrier messages, bandwidth limits per day\/week\/month, live traffic insights<\/li><li>Sub-users, white-label (your logo\/colours), REST API, webhooks and Telegram alerts included<\/li><li>Flat price, traffic is free \u2014 rides on your own SIM data plans<\/li><\/ul><\/div>\n<div class=\"ap-card__side\"><p class=\"ap-card__price\">$9 per dongle <small>per month<\/small><\/p><a class=\"ap-card__btn\" href=\"https:\/\/proxykite.com\/#pricing\">Talk to us \u2192<\/a><\/div>\n<\/aside>\n\n\n\n<h2 class=\"wp-block-heading\">What you need<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You need Python 3, Requests, a working proxy endpoint, and permission to access the destination you are calling. The examples use <code>https:\/\/httpbin.org\/ip<\/code> as a harmless endpoint that returns the observed public IP; replace it with a site or API you are authorised to access.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you are exposing your own 4G\/LTE dongle, <a href=\"https:\/\/proxykite.com\/docs\/guide\/proxy-formats\">ProxyKite&#8217;s proxy format guide<\/a> shows the HTTP and SOCKS5 formats. Its <a href=\"https:\/\/proxykite.com\/docs\/guide\/getting-started\">getting-started guide<\/a> covers the Raspberry Pi\/Linux installation. A 4G setup can work behind CGNAT because the box makes outbound connections; see <a href=\"https:\/\/proxykite.com\/blog\/cgnat-mobile-proxy\/\">why 4G port forwarding fails under CGNAT<\/a> for the networking background.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Keep proxy usernames, passwords, API tokens, and destination credentials out of source control. Use environment variables or a secrets manager for real runs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Build the <code>proxies<\/code> dictionary<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: Requests chooses a proxy from the dictionary using the URL scheme of the destination request.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For a normal HTTP proxy, use the proxy URL for both HTTP and HTTPS destinations:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import requests\n\nproxy_url = \"http:\/\/proxy.example.com:3128\"\nproxies = {\n    \"http\": proxy_url,\n    \"https\": proxy_url,\n}\n\nresponse = requests.get(\n    \"https:\/\/httpbin.org\/ip\",\n    proxies=proxies,\n    timeout=(10, 30),\n)\nresponse.raise_for_status()\nprint(response.json())<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>https<\/code> key describes the destination scheme. It does not mean that the proxy URL must start with <code>https:\/\/<\/code>; an HTTP CONNECT proxy is commonly written as <code>\"https\": \"http:\/\/host:port\"<\/code>. A proxy URL must include its scheme. Omitting it is a common cause of <code>InvalidSchema<\/code> or connection errors.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Success looks like a JSON response containing the IP observed by the test endpoint. It should be the proxy&#8217;s public egress IP, not necessarily the IP of the machine running Python.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Requests also honours <code>HTTP_PROXY<\/code>, <code>HTTPS_PROXY<\/code>, <code>ALL_PROXY<\/code>, and related environment variables. For predictable application behaviour, pass <code>proxies=proxies<\/code> on each request or centralise that argument in a small wrapper. The <a href=\"https:\/\/requests.readthedocs.io\/en\/stable\/user\/advanced\/#proxies\" target=\"_blank\" rel=\"noopener\">Requests proxy documentation<\/a> explains the precedence rules.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Add HTTP proxy authentication safely<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: Credentials belong in the proxy URL, but reserved characters in a username or password must be percent-encoded first.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This version reads the secret values from the environment and encodes them before assembling the URL:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import os\nfrom urllib.parse import quote\n\nimport requests\n\nproxy_user = quote(os.environ[\"PROXY_USER\"], safe=\"\")\nproxy_password = quote(os.environ[\"PROXY_PASSWORD\"], safe=\"\")\nproxy_host = os.environ[\"PROXY_HOST\"]\nproxy_port = os.environ[\"PROXY_PORT\"]\n\nproxy_url = (\n    f\"http:\/\/{proxy_user}:{proxy_password}@\"\n    f\"{proxy_host}:{proxy_port}\"\n)\nproxies = {\"http\": proxy_url, \"https\": proxy_url}\n\nresponse = requests.get(\n    \"https:\/\/httpbin.org\/ip\",\n    proxies=proxies,\n    timeout=(10, 30),\n)\nresponse.raise_for_status()\nprint(response.json())<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Set the variables in your shell, without placing the password in a committed <code>.py<\/code> file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export PROXY_USER=\"proxy-user\"\nexport PROXY_PASSWORD=\"replace-with-your-password\"\nexport PROXY_HOST=\"proxy.example.com\"\nexport PROXY_PORT=\"3128\"\npython check_proxy.py<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the proxy returns <code>407 Proxy Authentication Required<\/code>, check all four parts: the scheme, hostname, port, and credentials. A password containing <code>@<\/code>, <code>:<\/code>, <code>\/<\/code>, or <code>#<\/code> is especially likely to break an unencoded URL.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Use SOCKS5 with <code>requests[socks]<\/code><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: SOCKS support is an optional Requests extra, and <code>socks5h<\/code> makes the proxy resolve the destination hostname instead of resolving it locally.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Install the extra in the same virtual environment that runs your script:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>python -m pip install \"requests[socks]\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then use a SOCKS5 URL in both dictionary entries:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import os\nfrom urllib.parse import quote\n\nimport requests\n\nuser = quote(os.environ[\"PROXY_USER\"], safe=\"\")\npassword = quote(os.environ[\"PROXY_PASSWORD\"], safe=\"\")\nhost = os.environ[\"PROXY_HOST\"]\nport = os.environ[\"PROXY_PORT\"]\n\nproxy_url = f\"socks5h:\/\/{user}:{password}@{host}:{port}\"\nproxies = {\n    \"http\": proxy_url,\n    \"https\": proxy_url,\n}\n\nresponse = requests.get(\n    \"https:\/\/httpbin.org\/ip\",\n    proxies=proxies,\n    timeout=(10, 30),\n)\nresponse.raise_for_status()\nprint(response.json())<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Use <code>socks5<\/code> when you specifically want local DNS resolution. Use <code>socks5h<\/code> when the proxy should resolve the hostname. Requests documents both behaviours in its <a href=\"https:\/\/requests.readthedocs.io\/en\/stable\/user\/advanced\/#socks\" target=\"_blank\" rel=\"noopener\">SOCKS section<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If Python reports that SOCKS support is missing, the extra was installed into a different interpreter. Compare <code>python -m pip show requests PySocks<\/code> with <code>python -c \"import requests; print(requests.__file__)\"<\/code> from the same shell.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Use a Session, timeout and safe retries<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: A Session reuses connections and cookies, while explicit timeouts prevent a slow proxy or destination from hanging the worker forever.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Requests has no default timeout. Use a tuple so connection setup and response reading have separate limits. Add retries only for operations that are safe to repeat, such as idempotent reads:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import requests\nfrom requests.adapters import HTTPAdapter\nfrom urllib3.util import Retry\n\n\ndef make_session(proxies):\n    retry_policy = Retry(\n        total=3,\n        connect=3,\n        read=0,\n        status=3,\n        backoff_factor=0.5,\n        status_forcelist=[429, 502, 503, 504],\n        allowed_methods=frozenset({\"GET\", \"HEAD\", \"OPTIONS\"}),\n        respect_retry_after_header=True,\n    )\n\n    session = requests.Session()\n    adapter = HTTPAdapter(max_retries=retry_policy)\n    session.mount(\"http:\/\/\", adapter)\n    session.mount(\"https:\/\/\", adapter)\n    session.proxies.update(proxies)\n    return session\n\n\nproxies = {\n    \"http\": \"http:\/\/proxy.example.com:3128\",\n    \"https\": \"http:\/\/proxy.example.com:3128\",\n}\n\nwith make_session(proxies) as session:\n    response = session.get(\n        \"https:\/\/httpbin.org\/ip\",\n        proxies=proxies,\n        timeout=(10, 30),\n    )\n    response.raise_for_status()\n    print(response.json())<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The explicit <code>proxies<\/code> argument is intentional. Environment settings can override Session-level proxy values, so passing the dictionary at request time makes the route visible at the call site. The retry policy above does not retry reads after bytes may have been sent (<code>read=0<\/code>), and it does not retry POST requests. The <a href=\"https:\/\/urllib3.readthedocs.io\/en\/stable\/reference\/urllib3.util.html#urllib3.util.Retry\" target=\"_blank\" rel=\"noopener\">urllib3 Retry reference<\/a> describes these counters and method rules.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For a POST that creates a record, sends a payment, or changes state, handle the exception at the application level and decide whether repeating it is safe. A generic automatic retry can duplicate work.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Rotate the IP between batches through the API<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: Batch boundaries give you a clear point to finish the current work, rotate the dongle, and start new connections through the new mobile IP.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/proxykite.com\/blog\/wp-content\/uploads\/2026\/10\/python-requests-proxy-1.webp\" alt=\"ProxyKite&#x27;s rotation API shows the POST endpoint and bearer-token authentication used between batches.\"\/><figcaption class=\"wp-element-caption\">ProxyKite&#x27;s rotation API shows the POST endpoint and bearer-token authentication used between batches.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">ProxyKite&#8217;s rotation endpoint is a synchronous POST. Send the proxy ID in the path and a bearer token in the <code>Authorization<\/code> header. Use a longer read timeout for rotation than for an ordinary page fetch, then inspect the JSON response:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import os\n\nimport requests\n\n\ndef rotate_proxy(proxy_id):\n    token = os.environ[\"PROXYKIT_TOKEN\"]\n    url = f\"https:\/\/proxykite.com\/api\/v1\/proxies\/{proxy_id}\/rotate\"\n    response = requests.post(\n        url,\n        headers={\n            \"Authorization\": f\"Bearer {token}\",\n            \"Accept\": \"application\/json\",\n        },\n        timeout=(10, 90),\n    )\n    response.raise_for_status()\n    result = response.json()\n    if not result.get(\"ok\"):\n        raise RuntimeError(f\"Rotation was not accepted: {result}\")\n    return result\n\n\nrotation = rotate_proxy(proxy_id=7)\nprint(rotation[\"old_ip\"], \"-&gt;\", rotation[\"new_ip\"])<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The token is for the ProxyKite API, not for the proxy&#8217;s user\/password authentication. Keep both sets of credentials separate. The <a href=\"https:\/\/proxykite.com\/docs\/api\/rotation\">rotation API reference<\/a> lists the required ability and response fields.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To rotate after every batch, close the old Session, call the rotation endpoint once, and create a fresh Session. Closing the Session drops its pooled connections so the next batch establishes new connections through the same proxy endpoint:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from itertools import islice\n\n\ndef batches(items, size):\n    iterator = iter(items)\n    while batch := list(islice(iterator, size)):\n        yield batch\n\n\nurls = [\n    \"https:\/\/example.org\/page-1\",\n    \"https:\/\/example.org\/page-2\",\n    \"https:\/\/example.org\/page-3\",\n]\n\nfor batch in batches(urls, size=25):\n    with make_session(proxies) as session:\n        for url in batch:\n            response = session.get(url, proxies=proxies, timeout=(10, 30))\n            response.raise_for_status()\n            print(response.url, response.status_code)\n\n    result = rotate_proxy(proxy_id=7)\n    print(f\"Rotated {result['old_ip']} -&gt; {result['new_ip']}\")<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Do not rotate once per request unless the destination and your carrier plan are designed for that pattern. A batch size should reflect the job, rate limits, and the amount of state you want to keep together. For the networking model behind mobile IP changes, see <a href=\"https:\/\/proxykite.com\/blog\/how-4g-ip-rotation-works\/\">how 4G IP rotation works<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 6: Verify the route before running a large job<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: A small IP check catches a bad port, wrong credentials, or an accidentally bypassed proxy before you spend time on the full workload.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Run one request through the proxy and print the route returned by the test service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def check_route(proxies):\n    with make_session(proxies) as session:\n        response = session.get(\n            \"https:\/\/httpbin.org\/ip\",\n            proxies=proxies,\n            timeout=(10, 30),\n        )\n        response.raise_for_status()\n        return response.json()[\"origin\"]\n\n\nprint(\"Current egress:\", check_route(proxies))<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For a rotation test, record the value before the API call, rotate once, then call <code>check_route<\/code> with a newly created Session. Also log the API&#8217;s <code>old_ip<\/code> and <code>new_ip<\/code> fields. Do not log proxy passwords or bearer tokens.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common errors and fixes<\/h2>\n\n\n\n<figure class=\"wp-block-table ap-table\"><table><thead><tr><th>Symptom<\/th><th>Likely cause<\/th><th>Fix<\/th><\/tr><\/thead><tbody><tr><td><code>407 Proxy Authentication Required<\/code><\/td><td>Credentials are missing, wrong, or not URL-encoded.<\/td><td>Rebuild the proxy URL with <code>quote(..., safe=\"\")<\/code>; check the username, password, host, and port.<\/td><\/tr><tr><td><code>InvalidSchema<\/code> or \u201cproxy URL must include a scheme\u201d<\/td><td>The value is <code>host:port<\/code> instead of a complete URL.<\/td><td>Use <code>http:\/\/host:port<\/code>, <code>socks5:\/\/host:port<\/code>, or <code>socks5h:\/\/host:port<\/code>.<\/td><\/tr><tr><td><code>Missing dependencies for SOCKS support<\/code><\/td><td>The optional SOCKS dependency is not installed in this interpreter.<\/td><td>Run <code>python -m pip install \"requests[socks]\"<\/code> with the same <code>python<\/code> command that runs the script.<\/td><\/tr><tr><td>HTTPS requests resolve the wrong place<\/td><td><code>socks5<\/code> performs DNS locally.<\/td><td>Use <code>socks5h<\/code> when DNS should be resolved by the proxy.<\/td><\/tr><tr><td>The script hangs<\/td><td>No timeout was supplied, or the timeout is too generous for the job.<\/td><td>Set a connect\/read tuple such as <code>timeout=(10, 30)<\/code> and use a separate longer timeout for rotation.<\/td><\/tr><tr><td>A Session appears to ignore its proxy<\/td><td>Environment proxy variables override Session-level settings.<\/td><td>Pass <code>proxies=proxies<\/code> on each request, as shown above.<\/td><\/tr><tr><td>A rotation request is retried or duplicated<\/td><td>A POST was mounted behind a broad retry policy.<\/td><td>Keep rotation outside the fetch Session and call it once; retry only after confirming the operation is safe.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If a Huawei E3372 is the source of your proxy, confirm it is in HiLink mode and that the box can reach the internet before debugging Python. The <a href=\"https:\/\/proxykite.com\/blog\/huawei-e3372-proxy\/\">Huawei E3372 proxy guide<\/a> covers that hardware path.<\/p>\n\n\n\n<aside class=\"ap-cta\" aria-label=\"Turn dongles into proxies\"><div class=\"ap-cta__content\"><p class=\"ap-cta__eyebrow\">Run your own route<\/p><p class=\"ap-cta__title\">Turn dongles into proxies<\/p><p class=\"ap-cta__text\">ProxyKite connects your own HiLink dongles to HTTP and SOCKS5 endpoints with rotation and no per-GB charge.<\/p><\/div><a class=\"ap-cta__btn\" href=\"https:\/\/proxykite.com\/contact\">Contact us<\/a><\/aside>\n\n\n\n<h2 class=\"wp-block-heading\">FAQ<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">How do I set a proxy in Python Requests?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Create a dictionary with <code>http<\/code> and <code>https<\/code> keys, then pass it as <code>proxies=proxies<\/code> to <code>requests.get()<\/code> or <code>session.get()<\/code>. The values must be complete proxy URLs, including <code>http:\/\/<\/code>, <code>socks5:\/\/<\/code>, or <code>socks5h:\/\/<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How do I use a username and password with Requests proxies?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Put the credentials in the proxy URL as <code>scheme:\/\/user:password@host:port<\/code>. Percent-encode both values first, especially when they contain <code>@<\/code>, <code>:<\/code>, <code>\/<\/code>, or <code>#<\/code>, and keep the finished URL out of source control.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What is the difference between <code>socks5<\/code> and <code>socks5h<\/code> in Requests?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>requests[socks]<\/code> enables both schemes. <code>socks5<\/code> resolves the destination hostname on the client, while <code>socks5h<\/code> asks the proxy to resolve it. Use <code>socks5h<\/code> when the destination DNS lookup should follow the proxy route.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How do I rotate a proxy while using Python Requests?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Finish a batch, close the current Session, call the provider&#8217;s rotation endpoint, and create a new Session for the next batch. With ProxyKite, the rotation call is <code>POST \/api\/v1\/proxies\/{id}\/rotate<\/code> with a bearer token; inspect the returned <code>old_ip<\/code> and <code>new_ip<\/code> values.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why should every Requests call have a timeout?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Requests does not apply a default timeout, so a connection or response can wait indefinitely. A tuple such as <code>(10, 30)<\/code> separates connection setup from response reading and makes worker behaviour easier to control.<\/p>\n\n\n\n<script type=\"application\/ld+json\">{\"@context\": \"https:\/\/schema.org\", \"@type\": \"FAQPage\", \"mainEntity\": [{\"@type\": \"Question\", \"name\": \"How do I set a proxy in Python Requests?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Create a dictionary with http and https keys, then pass it as proxies=proxies to requests.get() or session.get(). The values must be complete proxy URLs, including http:\/\/, socks5:\/\/, or socks5h:\/\/.\"}}, {\"@type\": \"Question\", \"name\": \"How do I use a username and password with Requests proxies?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Put the credentials in the proxy URL as scheme:\/\/user:password@host:port. Percent-encode both values first, especially when they contain @, :, \/, or #, and keep the finished URL out of source control.\"}}, {\"@type\": \"Question\", \"name\": \"What is the difference between `socks5` and `socks5h` in Requests?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"requests[socks] enables both schemes. socks5 resolves the destination hostname on the client, while socks5h asks the proxy to resolve it. Use socks5h when the destination DNS lookup should follow the proxy route.\"}}, {\"@type\": \"Question\", \"name\": \"How do I rotate a proxy while using Python Requests?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Finish a batch, close the current Session, call the provider's rotation endpoint, and create a new Session for the next batch. With ProxyKite, the rotation call is POST \/api\/v1\/proxies\/{id}\/rotate with a bearer token; inspect the returned old_ip and new_ip values.\"}}, {\"@type\": \"Question\", \"name\": \"Why should every Requests call have a timeout?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Requests does not apply a default timeout, so a connection or response can wait indefinitely. A tuple such as (10, 30) separates connection setup from response reading and makes worker behaviour easier to control.\"}}]}<\/script>\n\n","protected":false},"excerpt":{"rendered":"Use a python requests proxy with HTTP or SOCKS5, credentials, timeouts, retries and IP rotation between batches, with practical working code.","protected":false},"author":1,"featured_media":283,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"csco_singular_sidebar":"","csco_page_header_type":"","csco_page_load_nextpost":"","footnotes":""},"categories":[5],"tags":[119,213,207,135,127],"class_list":["post-282","post","type-post","status-publish","format-standard","has-post-thumbnail","category-use-cases","tag-proxy-rotation","tag-python","tag-requests","tag-socks5","tag-web-scraping","cs-entry"],"_links":{"self":[{"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/posts\/282","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/comments?post=282"}],"version-history":[{"count":1,"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/posts\/282\/revisions"}],"predecessor-version":[{"id":516,"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/posts\/282\/revisions\/516"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/media\/283"}],"wp:attachment":[{"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/media?parent=282"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/categories?post=282"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/tags?post=282"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}