[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"blog-post-de-proxies-in-python-verwenden":3},{"success":4,"payload":5,"related":84,"errors":175},true,{"id":6,"slug":7,"title":8,"excerpt":9,"body_html":10,"meta_title":11,"meta_description":12,"canonical_url":13,"canonical_override":14,"og_title":15,"og_description":16,"og_image_url":17,"faq_json":18,"key_takeaways":34,"allow_index":40,"noindex_google_only":40,"allow_follow":4,"published_at":41,"updated_at":42,"content_updated_at":43,"featured_image_url":44,"featured_image_alt":14,"card_image_url":45,"reading_time_minutes":46,"author":47,"categories":51,"tags":58,"alternates":70,"locale_paths":72,"views":83},3,"proxies-in-python-verwenden","Proxies in Python verwenden (Requests + ProxyHat SDK)","Erfahren Sie, wie man Proxies in Python mit der Request-Bibliothek und ProxyHat SDK verwendet. Abdeckungen Authentifizierung, Rotation, Geotargeting, Fehlerbehandlung und Async-Schrott.","\u003Ch2>Warum Proxies in Python verwenden?\u003C\u002Fh2>\u003Cp>Python dominiert die Datenextraktionslandschaft. Bibliotheken wie \u003Cstrong>Anträge\u003C\u002Fstrong>, \u003Cstrong>httpx\u003C\u002Fstrong>, und \u003Cstrong>Schrott\u003C\u002Fstrong> Machen Sie HTTP-Anrufe trivial, aber ohne Proxies, Ihre Skripte treffen IP-Banns innerhalb von Minuten. Verwendung Proxies in Python Sie können IP-Adressen drehen, Geobeschränkungen umgehen und Ihre Abstreifvorgänge zuverlässig skalieren.\u003C\u002Fp>\u003Cp>In diesem Leitfaden lernen Sie, wie man Proxies in Python integriert \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FProxyHatCom\u002Fpython-sdk\" rel=\"noopener noreferrer\">ProxyHat Python SDK\u003C\u002Fa> und der Standard \u003Ccode>requests\u003C\u002Fcode> Bibliothek. Jeder Abschnitt enthält den Kopier-Pasta-ready-Code, den Sie sofort ausführen können.\u003C\u002Fp>\u003Cp>Ob Sie ein \u003Ca href=\"\u002Fde\u002Fuse-cases\u002Fweb-scraping\">Web-Schrott Rohrleitung\u003C\u002Fa>, Überwachung \u003Ca href=\"\u002Fde\u002Fuse-cases\u002Fserp-tracking\">SERP Ergebnisse\u003C\u002Fa>, oder das Sammeln von Preisdaten, dieser Leitfaden umfasst Authentifizierung, Proxy-Rotation, Geo-Targeting, Fehlerbehandlung und Produktionsskalierung.\u003C\u002Fp>\u003Ch2>Installation und Inbetriebnahme\u003C\u002Fh2>\u003Ch3>Installieren der ProxyHat SDK und Anfragen\u003C\u002Fh3>\u003Cp>Installieren Sie das ProxyHat Python SDK und das \u003Ccode>requests\u003C\u002Fcode> Bibliothek mit pip:\u003C\u002Fp>\u003Cpre>\u003Ccode>pip install proxyhat requests\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>Für async Workflows, auch installieren \u003Ccode>httpx\u003C\u002Fcode> und \u003Ccode>aiohttp\u003C\u002Fcode>:\u003C\u002Fp>\u003Cpre>\u003Ccode>pip install httpx aiohttp\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch3>Erhalten Sie Ihre API-Ergebnisse\u003C\u002Fh3>\u003Cp>Anmeldung bei \u003Ca href=\"\u002Fde\u002Fpricing\">ProxyHat\u003C\u002Fa> und Ihre API-Taste aus dem Dashboard abrufen. Sie benötigen Ihre \u003Cstrong>Benutzername\u003C\u002Fstrong> und Passwort vergessen? (oder API-Schlüssel) für die Proxy-Authentifizierung. Volle Authentifizierungsdetails sind in der \u003Ca href=\"https:\u002F\u002Fdocs.proxyhat.com\u002F\" rel=\"noopener noreferrer\">ProxyHat API Dokumentation\u003C\u002Fa>.\u003C\u002Fp>\u003Ch2>Authentifizierung und Grundkonfiguration\u003C\u002Fh2>\u003Ch3>Verwendung des ProxyHat SDK\u003C\u002Fh3>\u003Cp>Das SDK holt mit Ihrem API-Schlüssel die Zugangsdaten eines aktiven Sub-Users und baut daraus die Proxy-URL; die Anfragen selbst senden Sie mit \u003Ccode>requests\u003C\u002Fcode> oder \u003Ccode>httpx\u003C\u002Fcode>:\u003C\u002Fp>\u003Cpre>\u003Ccode>from proxyhat import ProxyHat\nclient = ProxyHat(\n    api_key=\"ph_your_api_key\"\n)\n# Test the connection: get a proxy URL for one of your active sub-users\nproxy_url = client.connection_url(country=\"us\")\nprint(proxy_url)\n# http:\u002F\u002F&lt;sub-user>-country-us:&lt;password>@gate.proxyhat.com:8080\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch3>Verwenden von Raw Proxy-Ergebnisse mit Anfragen\u003C\u002Fh3>\u003Cp>Wenn Sie es bevorzugen \u003Ccode>requests\u003C\u002Fcode> direkt die Proxy-URL konfigurieren:\u003C\u002Fp>\u003Cpre>\u003Ccode>import requests\nproxy_url = \"http:\u002F\u002Fusername:password@gate.proxyhat.com:8080\"\nproxies = {\n    \"http\": proxy_url,\n    \"https\": proxy_url,\n}\nresponse = requests.get(\n    \"https:\u002F\u002Fhttpbin.org\u002Fip\",\n    proxies=proxies,\n    timeout=30\n)\nprint(response.json())\n# {\"origin\": \"185.xxx.xxx.xxx\"}\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>Einfaches GET Anfrage mit einem Proxy\u003C\u002Fh2>\u003Cp>Hier ist ein komplettes Beispiel, das eine GET-Anfrage durch eine ProxyHat-Bewohnungs-Proxy sendet:\u003C\u002Fp>\u003Cpre>\u003Ccode>import requests\nfrom proxyhat import ProxyHat\nclient = ProxyHat(api_key=\"ph_your_api_key\")\nproxy = client.connection_url(country=\"us\")  # rotating residential\n# Make a proxied GET request\nresponse = requests.get(\"https:\u002F\u002Fhttpbin.org\u002Fip\", proxies={\"http\": proxy, \"https\": proxy}, timeout=30)\nprint(f\"Status: {response.status_code}\")\nprint(f\"IP: {response.json()['origin']}\")\nprint(f\"Headers: {response.headers}\")\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>Oder mit dem Standard \u003Ccode>requests\u003C\u002Fcode> Bibliothek:\u003C\u002Fp>\u003Cpre>\u003Ccode>import requests\nproxies = {\n    \"http\": \"http:\u002F\u002Fuser:pass@gate.proxyhat.com:8080\",\n    \"https\": \"http:\u002F\u002Fuser:pass@gate.proxyhat.com:8080\",\n}\nresponse = requests.get(\n    \"https:\u002F\u002Fexample.com\u002Fapi\u002Fdata\",\n    proxies=proxies,\n    timeout=30,\n    headers={\"User-Agent\": \"Mozilla\u002F5.0 (Windows NT 10.0; Win64; x64)\"}\n)\nprint(response.status_code)\nprint(response.text[:500])\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>Wahl des richtigen Proxy-Typs\u003C\u002Fh2>\u003Cp>ProxyHat bietet drei Proxytypen. Wählen Sie basierend auf Ihrem Anwendungsfall. Für einen tieferen Vergleich, lesen Sie unsere Anleitung auf \u003Ca href=\"\u002Fde\u002Fblog\u002Fresidential-vs-datacenter-vs-mobile-proxies-welchen-sollten-sie-verwenden\">Wohnen vs datacenter vs mobile proxies\u003C\u002Fa>.\u003C\u002Fp>\u003Ctable>\n\u003Ccaption>Wahl des richtigen Proxy-Typs\u003C\u002Fcaption>\u003Cthead>\u003Ctr>\u003Cth>Typ\u003C\u002Fth>\u003Cth>Das Beste für\u003C\u002Fth>\u003Cth>Geschwindigkeit\u003C\u002Fth>\u003Cth>Nachweisrisiko\u003C\u002Fth>\u003Cth>Kosten\u003C\u002Fth>\u003C\u002Ftr>\u003C\u002Fthead>\u003Ctbody>\u003Ctr>\u003Ctd>Wohngebiet\u003C\u002Ftd>\u003Ctd>Web-Schrott, SERP-Tracking\u003C\u002Ftd>\u003Ctd>Mittel\u003C\u002Ftd>\u003Ctd>Sehr niedrig\u003C\u002Ftd>\u003Ctd>Pro GB\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Datencenter\u003C\u002Ftd>\u003Ctd>Hochvolumige, geschwindigkeitskritische Aufgaben\u003C\u002Ftd>\u003Ctd>Schnell\u003C\u002Ftd>\u003Ctd>Höher\u003C\u002Ftd>\u003Ctd>Pro IP\u002FMonat\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Mobil\u003C\u002Ftd>\u003Ctd>Social Media, App-Tests\u003C\u002Ftd>\u003Ctd>Mittel\u003C\u002Ftd>\u003Ctd>Niedrigsten\u003C\u002Ftd>\u003Ctd>Pro GB\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Ch3>Schalten von Proxy-Typen in Code\u003C\u002Fh3>\u003Cpre>\u003Ccode>import requests\nfrom proxyhat import ProxyHat\nclient = ProxyHat(api_key=\"ph_your_api_key\")\n# Residential proxy (default)\nresidential = client.connection_url(country=\"us\")\nresponse = requests.get(\n    \"https:\u002F\u002Fexample.com\",\n    proxies={\"http\": residential, \"https\": residential},\n    timeout=30,\n)\n# Datacenter proxy: coming soon at ProxyHat\n# Mobile proxy: add -type-mobile to the username\nmobile = \"http:\u002F\u002FUSERNAME-country-us-type-mobile:PASSWORD@gate.proxyhat.com:8080\"\nresponse = requests.get(\n    \"https:\u002F\u002Fexample.com\",\n    proxies={\"http\": mobile, \"https\": mobile},\n    timeout=30,\n)\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>Rotating vs Sticky Sessions\u003C\u002Fh2>\u003Cp>Rotierende Proxis Senden Sie eine neue IP für jede Anfrage, ideal für großformatige Abstreifung, wo Sie maximale Anonymität benötigen. Sticky Sessions Halten Sie die gleiche IP für eine bestimmte Dauer, die für mehrstufige Workflows wie Login-Sequenzen oder paginierte Navigation unerlässlich ist.\u003C\u002Fp>\u003Ch3>Rotating Proxies (Neue IP Jede Anfrage)\u003C\u002Fh3>\u003Cpre>\u003Ccode>import requests\nfrom proxyhat import ProxyHat\nclient = ProxyHat(api_key=\"ph_your_api_key\")\nproxy = client.connection_url(country=\"us\")  # rotating is the default\nurls = [\n    \"https:\u002F\u002Fhttpbin.org\u002Fip\",\n    \"https:\u002F\u002Fhttpbin.org\u002Fip\",\n    \"https:\u002F\u002Fhttpbin.org\u002Fip\",\n]\nfor url in urls:\n    response = requests.get(url, proxies={\"http\": proxy, \"https\": proxy}, timeout=30)\n    print(f\"IP: {response.json()['origin']}\")\n# Each request uses a different IP:\n# IP: 185.xxx.xxx.1\n# IP: 92.xxx.xxx.47\n# IP: 78.xxx.xxx.203\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch3>Sticky Sessions (Same IP für Dauer)\u003C\u002Fh3>\u003Cpre>\u003Ccode>import requests\nfrom proxyhat import ProxyHat\nclient = ProxyHat(api_key=\"ph_your_api_key\")\n# Create a sticky session (maintains IP for up to 30 minutes)\nproxy = client.connection_url(country=\"us\", sticky=True)\nsession = requests.Session()\nsession.proxies = {\"http\": proxy, \"https\": proxy}\n# All requests in this session use the same IP\nfor page in range(1, 6):\n    response = session.get(f\"https:\u002F\u002Fexample.com\u002Fproducts?page={page}\", timeout=30)\n    ip = session.get(\"https:\u002F\u002Fhttpbin.org\u002Fip\", timeout=30).json()[\"origin\"]\n    print(f\"Page {page}: IP {ip}\")\n# Same IP across all pages:\n# Page 1: IP 185.xxx.xxx.42\n# Page 2: IP 185.xxx.xxx.42\n# Page 3: IP 185.xxx.xxx.42\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>Geo-Targeted Anfragen\u003C\u002Fh2>\u003Cp>Brauchen Sie Daten aus einem bestimmten Land? ProxyHat unterstützt \u003Ca href=\"\u002Fde\u002Flocations\">geo-targeting über 195+ Standorte\u003C\u002Fa>. Dies ist entscheidend für lokalisiertes SERP-Schrotten, Preisüberwachung und Inhaltsprüfung.\u003C\u002Fp>\u003Cpre>\u003Ccode>import requests\nfrom proxyhat import ProxyHat\nclient = ProxyHat(api_key=\"ph_your_api_key\")\n# Target a specific country\nproxy = client.connection_url(country=\"us\")\nresponse = requests.get(\n    \"https:\u002F\u002Fwww.google.com\u002Fsearch?q=best+restaurants\",\n    proxies={\"http\": proxy, \"https\": proxy},\n    timeout=30,\n)\n# Target a specific city\nproxy = client.connection_url(country=\"us\", region=\"new_york\", city=\"new_york_city\")\nresponse = requests.get(\n    \"https:\u002F\u002Fwww.google.com\u002Fsearch?q=best+restaurants\",\n    proxies={\"http\": proxy, \"https\": proxy},\n    timeout=30,\n)\n# Using raw proxy URL with geo-targeting\n# Format: username-country-us:password@gate.proxyhat.com:8080\nproxies = {\n    \"http\": \"http:\u002F\u002Fuser-country-de:pass@gate.proxyhat.com:8080\",\n    \"https\": \"http:\u002F\u002Fuser-country-de:pass@gate.proxyhat.com:8080\",\n}\nresponse = requests.get(\"https:\u002F\u002Fwww.google.de\", proxies=proxies, timeout=30)\nprint(f\"Accessed from Germany: {response.status_code}\")\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>Fehlerbehandlung und Retries\u003C\u002Fh2>\u003Cp>Netzwerkanfragen scheitern. Proxies Timeout. Ziele blockieren Sie. Robuste Fehlerbehandlung trennt Produktionsabstreifer von Spielzeugskripten.\u003C\u002Fp>\u003Ch3>Basic Retry Logic\u003C\u002Fh3>\u003Cpre>\u003Ccode>import time\nimport requests\nfrom requests.exceptions import ProxyError, Timeout, ConnectionError\ndef fetch_with_retry(url, proxies, max_retries=3, timeout=30):\n    \"\"\"Fetch a URL with automatic retry on failure.\"\"\"\n    for attempt in range(max_retries):\n        try:\n            response = requests.get(\n                url,\n                proxies=proxies,\n                timeout=timeout,\n                headers={\"User-Agent\": \"Mozilla\u002F5.0\"}\n            )\n            response.raise_for_status()\n            return response\n        except (ProxyError, Timeout, ConnectionError) as e:\n            wait = 2 ** attempt  # Exponential backoff\n            print(f\"Attempt {attempt + 1} failed: {e}. Retrying in {wait}s...\")\n            time.sleep(wait)\n        except requests.exceptions.HTTPError as e:\n            if e.response.status_code == 429:\n                wait = 10 * (attempt + 1)\n                print(f\"Rate limited. Waiting {wait}s...\")\n                time.sleep(wait)\n            elif e.response.status_code >= 500:\n                time.sleep(2 ** attempt)\n            else:\n                raise\n    raise Exception(f\"Failed to fetch {url} after {max_retries} attempts\")\n# Usage\nproxies = {\n    \"http\": \"http:\u002F\u002Fuser:pass@gate.proxyhat.com:8080\",\n    \"https\": \"http:\u002F\u002Fuser:pass@gate.proxyhat.com:8080\",\n}\nresponse = fetch_with_retry(\"https:\u002F\u002Fexample.com\u002Fdata\", proxies)\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch3>Automatische Retries mit requests und urllib3\u003C\u002Fh3>\u003Cpre>\u003Ccode>import requests\nfrom requests.adapters import HTTPAdapter\nfrom urllib3.util.retry import Retry\nfrom proxyhat import ProxyHat\nclient = ProxyHat(api_key=\"ph_your_api_key\")\nproxy = client.connection_url(country=\"us\")\n# The SDK builds the proxy URL; retries come from requests\u002Furllib3\nsession = requests.Session()\nretry = Retry(total=3, backoff_factor=1, status_forcelist=[429, 500, 502, 503])\nsession.mount(\"http:\u002F\u002F\", HTTPAdapter(max_retries=retry))\nsession.mount(\"https:\u002F\u002F\", HTTPAdapter(max_retries=retry))\nsession.proxies = {\"http\": proxy, \"https\": proxy}\nresponse = session.get(\"https:\u002F\u002Fexample.com\u002Fdata\", timeout=30)\nprint(response.status_code)\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>Concurrent Scraping mit Gewinde\u003C\u002Fh2>\u003Cp>Folgewünsche sind langsam. Für Produktionsarbeiten verwenden Sie Pythons \u003Ccode>concurrent.futures\u003C\u002Fcode> Anfragen durch Proxies parallelisieren.\u003C\u002Fp>\u003Cpre>\u003Ccode>from concurrent.futures import ThreadPoolExecutor, as_completed\nimport requests\nfrom proxyhat import ProxyHat\nclient = ProxyHat(api_key=\"ph_your_api_key\")\nproxy = client.connection_url(country=\"us\")  # rotating residential\nproxies = {\"http\": proxy, \"https\": proxy}\nurls = [\n    \"https:\u002F\u002Fexample.com\u002Fproduct\u002F1\",\n    \"https:\u002F\u002Fexample.com\u002Fproduct\u002F2\",\n    \"https:\u002F\u002Fexample.com\u002Fproduct\u002F3\",\n    \"https:\u002F\u002Fexample.com\u002Fproduct\u002F4\",\n    \"https:\u002F\u002Fexample.com\u002Fproduct\u002F5\",\n]\ndef scrape(url):\n    \"\"\"Scrape a single URL through the proxy.\"\"\"\n    response = requests.get(url, proxies=proxies, timeout=30)\n    return {\"url\": url, \"status\": response.status_code, \"length\": len(response.text)}\n# Run 5 concurrent requests\nresults = []\nwith ThreadPoolExecutor(max_workers=5) as executor:\n    futures = {executor.submit(scrape, url): url for url in urls}\n    for future in as_completed(futures):\n        try:\n            result = future.result()\n            results.append(result)\n            print(f\"OK: {result['url']} ({result['length']} bytes)\")\n        except Exception as e:\n            print(f\"Error: {futures[future]} - {e}\")\nprint(f\"\\nCompleted: {len(results)}\u002F{len(urls)}\")\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch3>Async Scraping mit Asyncio und httpx\u003C\u002Fh3>\u003Cpre>\u003Ccode>import asyncio\nimport httpx\nasync def scrape_urls(urls, proxy_url, max_concurrent=10):\n    \"\"\"Scrape multiple URLs concurrently using async proxies.\"\"\"\n    semaphore = asyncio.Semaphore(max_concurrent)\n    async def fetch(client, url):\n        async with semaphore:\n            response = await client.get(url, timeout=30)\n            return {\"url\": url, \"status\": response.status_code}\n    async with httpx.AsyncClient(proxy=proxy_url) as client:\n        tasks = [fetch(client, url) for url in urls]\n        return await asyncio.gather(*tasks, return_exceptions=True)\n# Usage\nproxy_url = \"http:\u002F\u002Fuser:pass@gate.proxyhat.com:8080\"\nurls = [f\"https:\u002F\u002Fexample.com\u002Fpage\u002F{i}\" for i in range(1, 51)]\nresults = asyncio.run(scrape_urls(urls, proxy_url))\nsuccessful = [r for r in results if not isinstance(r, Exception)]\nprint(f\"Scraped {len(successful)}\u002F{len(urls)} pages\")\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>Integration mit beliebten Python Libraries\u003C\u002Fh2>\u003Ch3>Verwendung mit Anfragen (Session)\u003C\u002Fh3>\u003Cpre>\u003Ccode>import requests\nsession = requests.Session()\nsession.proxies = {\n    \"http\": \"http:\u002F\u002Fuser:pass@gate.proxyhat.com:8080\",\n    \"https\": \"http:\u002F\u002Fuser:pass@gate.proxyhat.com:8080\",\n}\nsession.headers.update({\n    \"User-Agent\": \"Mozilla\u002F5.0 (Windows NT 10.0; Win64; x64)\"\n})\n# All requests in this session use the proxy\nresponse = session.get(\"https:\u002F\u002Fexample.com\u002Fapi\u002Fproducts\")\nprint(response.json())\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch3>Verwendung von httpx\u003C\u002Fh3>\u003Cpre>\u003Ccode>import httpx\nproxy_url = \"http:\u002F\u002Fuser:pass@gate.proxyhat.com:8080\"\n# Synchronous\nwith httpx.Client(proxy=proxy_url) as client:\n    response = client.get(\"https:\u002F\u002Fhttpbin.org\u002Fip\")\n    print(response.json())\n# Asynchronous\nasync with httpx.AsyncClient(proxy=proxy_url) as client:\n    response = await client.get(\"https:\u002F\u002Fhttpbin.org\u002Fip\")\n    print(response.json())\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch3>Verwendung von aiohttp\u003C\u002Fh3>\u003Cpre>\u003Ccode>import aiohttp\nimport asyncio\nasync def fetch_with_aiohttp():\n    proxy_url = \"http:\u002F\u002Fuser:pass@gate.proxyhat.com:8080\"\n    async with aiohttp.ClientSession() as session:\n        async with session.get(\n            \"https:\u002F\u002Fhttpbin.org\u002Fip\",\n            proxy=proxy_url,\n            timeout=aiohttp.ClientTimeout(total=30)\n        ) as response:\n            data = await response.json()\n            print(f\"IP: {data['origin']}\")\nasyncio.run(fetch_with_aiohttp())\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch3>Mit Scrapy\u003C\u002Fh3>\u003Cp>Fügen Sie ProxyHat zu Ihrer Scrapy Spinne hinzu, indem Sie die \u003Ccode>settings.py\u003C\u002Fcode>:\u003C\u002Fp>\u003Cpre>\u003Ccode># settings.py\nDOWNLOADER_MIDDLEWARES = {\n    \"scrapy.downloadermiddlewares.httpproxy.HttpProxyMiddleware\": 110,\n}\nHTTP_PROXY = \"http:\u002F\u002Fuser:pass@gate.proxyhat.com:8080\"\n# Or set per-request in your spider:\nimport scrapy\nclass ProductSpider(scrapy.Spider):\n    name = \"products\"\n    start_urls = [\"https:\u002F\u002Fexample.com\u002Fproducts\"]\n    def start_requests(self):\n        for url in self.start_urls:\n            yield scrapy.Request(\n                url,\n                meta={\"proxy\": \"http:\u002F\u002Fuser:pass@gate.proxyhat.com:8080\"},\n                callback=self.parse\n            )\n    def parse(self, response):\n        for product in response.css(\".product-card\"):\n            yield {\n                \"name\": product.css(\"h2::text\").get(),\n                \"price\": product.css(\".price::text\").get(),\n            }\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>Produktionstipps\u003C\u002Fh2>\u003Ch3>Anschluss Pooling und Timeouts\u003C\u002Fh3>\u003Cpre>\u003Ccode>import requests\nfrom requests.adapters import HTTPAdapter\nfrom urllib3.util.retry import Retry\nsession = requests.Session()\n# Configure retry strategy\nretry_strategy = Retry(\n    total=3,\n    backoff_factor=1,\n    status_forcelist=[429, 500, 502, 503, 504],\n)\nadapter = HTTPAdapter(\n    max_retries=retry_strategy,\n    pool_connections=10,\n    pool_maxsize=20\n)\nsession.mount(\"http:\u002F\u002F\", adapter)\nsession.mount(\"https:\u002F\u002F\", adapter)\nsession.proxies = {\n    \"http\": \"http:\u002F\u002Fuser:pass@gate.proxyhat.com:8080\",\n    \"https\": \"http:\u002F\u002Fuser:pass@gate.proxyhat.com:8080\",\n}\n# Robust, production-ready request\nresponse = session.get(\"https:\u002F\u002Fexample.com\u002Fdata\", timeout=(5, 30))\nprint(response.status_code)\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch3>Protokollierung und Überwachung\u003C\u002Fh3>\u003Cpre>\u003Ccode>import logging\nimport time\nlogging.basicConfig(level=logging.INFO, format=\"%(asctime)s %(message)s\")\nlogger = logging.getLogger(\"scraper\")\ndef monitored_request(session, url):\n    \"\"\"Log request timing and status for monitoring.\"\"\"\n    start = time.time()\n    try:\n        response = session.get(url, timeout=30)\n        elapsed = time.time() - start\n        logger.info(f\"OK {response.status_code} {url} ({elapsed:.2f}s)\")\n        return response\n    except Exception as e:\n        elapsed = time.time() - start\n        logger.error(f\"FAIL {url} ({elapsed:.2f}s): {e}\")\n        raise\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch3>Umgebungsvariablen für Anmeldeinformationen\u003C\u002Fh3>\u003Cp>Nie Hardcode Anmeldeinformationen. Verwenden Sie Umgebungsvariablen:\u003C\u002Fp>\u003Cpre>\u003Ccode>import os\nfrom proxyhat import ProxyHat\nclient = ProxyHat(\n    api_key=os.environ[\"PROXYHAT_API_KEY\"]\n)\n# Or with raw proxy URL\nproxy_url = os.environ.get(\n    \"PROXY_URL\",\n    \"http:\u002F\u002Fuser:pass@gate.proxyhat.com:8080\"\n)\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>Für eine vollständige Liste der verfügbaren Proxypläne und Verkehrsoptionen, besuchen Sie unsere \u003Ca href=\"\u002Fde\u002Fpricing\">Seite\u003C\u002Fa>. Für fortgeschrittene Anwendungsfälle und Endpunktreferenz siehe die \u003Ca href=\"https:\u002F\u002Fdocs.proxyhat.com\u002F\" rel=\"noopener noreferrer\">API-Dokumentation\u003C\u002Fa>. Sie können auch unsere Anleitung auf der \u003Ca href=\"\u002Fde\u002Fblog\u002Fbeste-proxies-fuer-web-scraping-2026\">beste Proxies für Web-Schrott in 2026\u003C\u002Fa> für Anbietervergleiche.\u003C\u002Fp>\u003Cblockquote>\u003Ch3>Schlüsselanhänger\u003C\u002Fh3>\u003Cul>\u003Cli>Installieren Sie in einem Befehl: \u003Ccode>pip install proxyhat requests\u003C\u002Fcode> Sie werden sofort gestartet.\u003C\u002Fli>\u003Cli>Verwenden Sie das SDK für Einfachheit: Das ProxyHat Python SDK erzeugt die Proxy-URL samt Geo-Targeting und Sticky-Sessions; die Rotation übernimmt das Gateway, Retries Ihr HTTP-Client.\u003C\u002Fli>\u003Cli>Wählen Sie den richtigen Proxytyp: Wohnort für Schrott, Rechenzentrum für Geschwindigkeit, mobil für soziale Plattformen.\u003C\u002Fli>\u003Cli>Rotieren vs Stick: Verwenden Sie rotierende Proxies für Schüttgutschrott, klebrige Sessions für mehrstufige Workflows.\u003C\u002Fli>\u003Cli>Geotarget bei Bedarf: Geben Sie Land und Stadt für die lokale Datenerhebung an.\u003C\u002Fli>\u003Cli>Fehler richtig handhaben: Ergänzen Sie exponentielle Backoff- und Retry-Logik für die Produktionssicherheit.\u003C\u002Fli>\u003Cli>Waage mit Konkurs: Verwendung \u003Ccode>ThreadPoolExecutor\u003C\u002Fcode> oder \u003Ccode>asyncio\u003C\u002Fcode> die Anfragen parallelisieren.\u003C\u002Fli>\u003Cli>\u003Cstrong>Nie Hardcode Anmeldeinformationen:\u003C\u002Fstrong> Speichern Sie API-Tasten in Umgebungsvariablen.\u003C\u002Fli>\u003C\u002Ful>\u003C\u002Fblockquote>","Proxies in Python: Requests + SDK Anleitung","Erfahren Sie, wie Sie Proxies in Python mit Requests und dem ProxyHat SDK konfigurieren. Code-Beispiele für Rotation, Geo-Targeting, Retries und Async-Scraping.","\u002Fde\u002Fblog\u002Fproxies-in-python-verwenden",null,"Proxies in Python verwenden: Requests + SDK Anleitung","Proxies in Python mit Requests und dem ProxyHat SDK konfigurieren. Code-Beispiele für Rotation, Geo-Targeting, Retries und Async-Scraping.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fproxies-in-python-verwenden-og.webp",[19,22,25,28,31],{"question":20,"answer":21},"Wie richte ich einen Proxy in Python Requests ein?","Übergeben Sie ein Proxies-Dictionary an jede Requests-Methode: requests.get(url, proxies={\"http\": \"http:\u002F\u002Fuser:pass@host:port\", \"https\": \"http:\u002F\u002Fuser:pass@host:port\"}). Das ProxyHat SDK vereinfacht dies weiter, indem es die Proxy-Konfiguration intern verwaltet.",{"question":23,"answer":24},"Was ist der Unterschied zwischen rotierenden und Sticky Proxies in Python?","Rotierende Proxies weisen jeder Anfrage eine neue IP-Adresse zu, was ideal für groß angelegtes Scraping ist. Sticky Proxies behalten dieselbe IP für eine festgelegte Dauer (z. B. 10-30 Minuten), was für Login-Sessions, Warenkörbe oder paginiertes Browsen notwendig ist, bei denen IP-Konsistenz wichtig ist.",{"question":26,"answer":27},"Kann ich ProxyHat Proxies mit asyncio und aiohttp verwenden?","Ja. ProxyHat Proxies funktionieren mit jedem HTTP-Client, der Proxy-Konfiguration unterstützt, einschließlich aiohttp, httpx (Async-Modus) und asyncio-basierten Frameworks. Übergeben Sie die Proxy-URL als Proxy-Parameter in Ihrem Async-Client.",{"question":29,"answer":30},"Wie behandle ich Proxy-Fehler und Timeouts in Python?","Umschließen Sie Ihre Anfragen mit try\u002Fexcept-Blöcken, die ProxyError, Timeout und ConnectionError abfangen. Implementieren Sie exponentielles Backoff (Verdopplung der Wartezeit zwischen Wiederholungen) und setzen Sie eine maximale Anzahl von Wiederholungen. Das ProxyHat SDK enthält eine integrierte Retry-Logik mit konfigurierbaren Parametern.",{"question":32,"answer":33},"Welche Python-Bibliothek ist am besten für Web Scraping mit Proxies?","Für einfache Aufgaben ist Requests mit dem ProxyHat SDK die einfachste Option. Für hochparalleles Async-Scraping verwenden Sie httpx oder aiohttp. Für komplexes Crawling mit Link-Verfolgung und Datenextraktion ist Scrapy mit Proxy-Middleware die leistungsstärkste Wahl. Alle funktionieren nahtlos mit ProxyHat Proxies.",[35,36,37,38,39],"Proxies in Python verhindern IP-Banns, umgehen Geobeschränkungen und ermöglichen zuverlässiges Skalieren von Web-Scraping.","Das ProxyHat SDK übernimmt Authentifizierung, Rotation und Verbindungsmanagement automatisch; alternativ lässt sich die requests-Bibliothek direkt nutzen.","Rotierende Proxies geben jede Anfrage eine neue IP, während Sticky Sessions dieselbe IP für bis zu 30 Minuten beibehalten.","Geo-Targeting für über 195 Standorte ist per Parameter oder durch Ergänzung im Proxy-URL-Benutzernamen möglich.","Für Produktionsscraping sollten Retry-Logik mit exponentiellem Backoff, Timeouts und parallele Requests mit ThreadPoolExecutor oder asyncio eingesetzt werden.",false,"2026-01-05T10:53:19+00:00","2026-07-19T03:13:07+00:00","2026-11-17T10:40:54+00:00","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fproxies-in-python-verwenden-master.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fproxies-in-python-verwenden-card.webp",12,{"name":48,"slug":49,"bio":50,"avatar_url":14,"website_url":14,"social_links":14},"ProxyHat Team","proxyhat-team","The ProxyHat editorial team covers proxies, web scraping, and data extraction.",[52],{"id":53,"slug":54,"name":55,"description":14,"meta_title":56,"meta_description":57,"parent_id":14},4,"entwickler-anleitungen","Entwickler-Anleitungen","Entwickler-Anleitungen | ProxyHat Blog","Code-Tutorials und SDK-Anleitungen zur Proxy-Integration in Ihre Anwendungen.",[59,63,67],{"id":60,"slug":61,"name":62},1,"web-scraping","Web Scraping",{"id":64,"slug":65,"name":66},9,"python","Python",{"id":46,"slug":68,"name":69},"sdk","SDK",{"en":71,"x-default":71},"\u002Fblog\u002Fusing-proxies-in-python",{"ko":73,"fr":74,"tr":75,"es":76,"de":13,"it":77,"pl":78,"en":71,"ru":79,"ja":80,"zh":81,"pt":82},"\u002Fko\u002Fblog\u002Fpython-proxy-sayongbeop","\u002Ffr\u002Fblog\u002Futiliser-des-proxies-en-python","\u002Ftr\u002Fblog\u002Fpython-ile-proxy-kullanimi","\u002Fes\u002Fblog\u002Fusar-proxies-en-python","\u002Fit\u002Fblog\u002Futilizzando-proxies-in-python-richiesta-proxyhat-sdk","\u002Fpl\u002Fblog\u002Fkorzystanie-z-proxies-w-python-requests-proxyhat-sdk","\u002Fru\u002Fblog\u002Fispolzovanie-proksi-v-python","\u002Fja\u002Fblog\u002Fpython-de-prokishi-wo-tsukau","\u002Fcn\u002Fblog\u002Fpython-shiyong-daili","\u002Fpt\u002Fblog\u002Fusando-proxies-em-python",65,[85,113,140,157],{"id":86,"slug":87,"title":88,"excerpt":89,"featured_image_url":90,"featured_image_alt":91,"card_image_url":92,"og_image_url":93,"published_at":94,"updated_at":95,"content_updated_at":96,"reading_time_minutes":97,"is_featured":40,"indexable":4,"views":98,"author":99,"categories":100,"tags":102},210,"proxy-einrichtung-fuer-ki-agenten","Proxy für KI-Agenten einrichten: browser-use, Crawl4AI und MCP","Agenten auf Cloud-VMs treten mit Datacenter-IPs ins Netz. Hier finden Sie aktuelle, funktionierende Proxy-Konfigurationen für browser-use, Crawl4AI und einen MCP-Server, eine Entscheidungstabelle für Sticky vs. Rotation und die Kostenfallen, die Sie vermeiden sollten.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fde\u002Fproxy-einrichtung-fuer-ki-agenten-master.webp","Proxy Setup for AI Agents: browser-use, Crawl4AI and an MCP Server","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fde\u002Fproxy-einrichtung-fuer-ki-agenten-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fde\u002Fproxy-einrichtung-fuer-ki-agenten-og.webp","2026-10-24T09:00:00+00:00","2026-10-24T09:00:20+00:00","2026-10-03T09:41:41+00:00",14,31,{"name":48,"slug":49,"bio":50,"avatar_url":14,"website_url":14,"social_links":14},[101],{"id":53,"slug":54,"name":55,"description":14,"meta_title":56,"meta_description":57,"parent_id":14},[103,104,108,109],{"id":60,"slug":61,"name":62},{"id":105,"slug":106,"name":107},2,"residential-proxies","Residential Proxies",{"id":64,"slug":65,"name":66},{"id":110,"slug":111,"name":112},22,"playwright","Playwright",{"id":114,"slug":115,"title":116,"excerpt":117,"featured_image_url":118,"featured_image_alt":119,"card_image_url":120,"og_image_url":121,"published_at":122,"updated_at":123,"content_updated_at":96,"reading_time_minutes":97,"is_featured":40,"indexable":4,"views":124,"author":125,"categories":126,"tags":128},206,"camoufox-residential-proxies-python-anleitung","Camoufox mit Residential Proxies: Python-Anleitung mit Code","So betreiben Sie Camoufox, den in C++ gepatchten Firefox, hinter Residential Proxies: aktuelle Python-API, warum geoip eine Sticky Session braucht, eine Checkliste zur Fingerprint-Kohärenz und wann Patchright oder nodriver besser passt.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fde\u002Fcamoufox-residential-proxies-python-anleitung-master.webp","Camoufox with Residential Proxies: A Code-First Python Guide","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fde\u002Fcamoufox-residential-proxies-python-anleitung-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fde\u002Fcamoufox-residential-proxies-python-anleitung-og.webp","2026-10-13T09:00:00+00:00","2026-10-13T09:00:22+00:00",44,{"name":48,"slug":49,"bio":50,"avatar_url":14,"website_url":14,"social_links":14},[127],{"id":53,"slug":54,"name":55,"description":14,"meta_title":56,"meta_description":57,"parent_id":14},[129,130,134,138,139],{"id":60,"slug":61,"name":62},{"id":131,"slug":132,"name":133},6,"anti-erkennung","Anti-Erkennung",{"id":135,"slug":136,"name":137},21,"headless-browser","Headless Browser",{"id":64,"slug":65,"name":66},{"id":105,"slug":106,"name":107},{"id":141,"slug":142,"title":143,"excerpt":144,"featured_image_url":145,"featured_image_alt":14,"card_image_url":146,"og_image_url":147,"published_at":148,"updated_at":42,"content_updated_at":149,"reading_time_minutes":46,"is_featured":40,"indexable":40,"views":150,"author":151,"categories":152,"tags":154},50,"zuverlaessige-scraping-architektur","Eine zuverlässige Scraping-Architektur entwerfen","Entwerfen Sie ein End-to-End-Schrottsystem: Scheduler, URL-Warte, Crawler-Pool, Proxy-Schicht, Parser, Speicher und Überwachung. Produktionsbereiter Python-Code mit Architekturdiagrammen.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fzuverlaessige-scraping-architektur-master.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fzuverlaessige-scraping-architektur-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fzuverlaessige-scraping-architektur-og.webp","2026-02-24T06:55:16+00:00","2026-10-03T08:21:36+00:00",68,{"name":48,"slug":49,"bio":50,"avatar_url":14,"website_url":14,"social_links":14},[153],{"id":53,"slug":54,"name":55,"description":14,"meta_title":56,"meta_description":57,"parent_id":14},[155,156],{"id":46,"slug":68,"name":69},{"id":60,"slug":61,"name":62},{"id":158,"slug":159,"title":160,"excerpt":161,"featured_image_url":162,"featured_image_alt":14,"card_image_url":163,"og_image_url":164,"published_at":165,"updated_at":42,"content_updated_at":166,"reading_time_minutes":167,"is_featured":40,"indexable":40,"views":168,"author":169,"categories":170,"tags":172},41,"proxy-performance-ueberwachen","Proxy-Performance überwachen: Latenz, Erfolgsrate und Alarme","Erfahren Sie, wie man die Proxy-Performance instrumentiert, überwacht und alarmiert – Latenzprozentile, Erfolgsquoten, Fehlermuster und Bandbreite. Codebeispiele in Python, Node.js und Go.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fproxy-performance-ueberwachen-master.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fproxy-performance-ueberwachen-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fproxy-performance-ueberwachen-og.webp","2026-02-15T00:39:23+00:00","2026-10-03T08:21:30+00:00",11,75,{"name":48,"slug":49,"bio":50,"avatar_url":14,"website_url":14,"social_links":14},[171],{"id":53,"slug":54,"name":55,"description":14,"meta_title":56,"meta_description":57,"parent_id":14},[173,174],{"id":46,"slug":68,"name":69},{"id":60,"slug":61,"name":62},[]]