[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"blog-post-tr-python-ile-proxy-kullanimi":3},{"success":4,"payload":5,"related":87,"errors":178},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":37,"allow_index":43,"noindex_google_only":43,"allow_follow":4,"published_at":44,"updated_at":45,"content_updated_at":46,"featured_image_url":47,"featured_image_alt":14,"card_image_url":48,"reading_time_minutes":49,"author":50,"categories":54,"tags":61,"alternates":73,"locale_paths":75,"views":86},3,"python-ile-proxy-kullanimi","Python'da Proxy Kullanımı (Requests + ProxyHat SDK)","Python'da İstekler kütüphanesi ve ProxyHat SDK ile nasıl kullanılacağını öğrenin. Kapaklar kimlik doğrulama, rotasyon, geo-targeting, hata işleme ve async scraping.","\u003Ch2>Neden Python'da Proxies kullanın?\u003C\u002Fh2>\u003Cp>Python veri çekilmesi manzarasını hakim eder. Kütüphaneler gibi kütüphaneler \u003Cstrong>İstekler\u003C\u002Fstrong>, \u003Cstrong>httpx\u003C\u002Fstrong>Ve \u003Cstrong>Yararlı\u003C\u002Fstrong> HTTP önemsiz diyor, ancak proxy olmadan, senaryolarınız birkaç dakika içinde IP yasaklarını vurdu. Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using \u003Cstrong>Python'da Kaynaklar\u003C\u002Fstrong> IP adreslerini döndürün, geo-restrictions'ı atlayın ve kazı operasyonlarınızı güvenilir bir şekilde ölçeklendirmenize izin verin.\u003C\u002Fp>\u003Cp>Bu kılavuzda, temsilcileri Python'a nasıl entegre edeceğinizi öğreneceksiniz \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FProxyHatCom\u002Fpython-sdk\" rel=\"noopener noreferrer\">ProxyHat Python SDK\u003C\u002Fa> Ve standart \u003Ccode>requests\u003C\u002Fcode> Kütüphane. Her bölüm hemen çalıştırabileceğiniz kopya-paste-ready kodunu içermektedir.\u003C\u002Fp>\u003Cp>İsterseniz \u003Ca href=\"\u002Ftr\u002Fuse-cases\u002Fweb-scraping\">Web scraping pipeline\u003C\u002Fa>, izleme \u003Ca href=\"\u002Ftr\u002Fuse-cases\u002Fserp-tracking\">SERP sonuçları\u003C\u002Fa>, veya fiyatlandırma verilerini toplamak, bu kılavuz kimlik doğrulamayı, proxy rotasyonunu, geo-targeting, hata işlemeyi ve üretim ölçeklendirmesini kapsar.\u003C\u002Fp>\u003Ch2>Kurulum ve Kurulum\u003C\u002Fh2>\u003Ch3>ProxyHat SDK'sını yükleyin ve İstekler\u003C\u002Fh3>\u003Cp>ProxyHat Python SDK ve the \u003Ccode>requests\u003C\u002Fcode> Boru kullanarak kütüphane:\u003C\u002Fp>\u003Cpre>\u003Ccode>pip install proxyhat requests\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>Async iş akışları için, aynı zamanda yükleme \u003Ccode>httpx\u003C\u002Fcode> ve \u003Ccode>aiohttp\u003C\u002Fcode>:\u003C\u002Fp>\u003Cpre>\u003Ccode>pip install httpx aiohttp\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch3>API Credentials\u003C\u002Fh3>\u003Cp>kaydolun \u003Ca href=\"\u002Ftr\u002Fpricing\">ProxyHat\u003C\u002Fa> API anahtarını panodan alın. Size ihtiyacınız olacak \u003Cstrong>Kullanıcı adı\u003C\u002Fstrong> ve şifre şifre şifre (veya API anahtarı) proxy doğrulama için. Tam kimlik doğrulama detayları mevcuttur \u003Ca href=\"https:\u002F\u002Fdocs.proxyhat.com\u002F\" rel=\"noopener noreferrer\">ProxyHat API belgeleri\u003C\u002Fa>.\u003C\u002Fp>\u003Ch2>Doğrulama ve Temel Yapılama\u003C\u002Fh2>\u003Ch3>ProxyHat SDK'sını kullanarak\u003C\u002Fh3>\u003Cp>SDK, API anahtarınızla aktif bir alt kullanıcıyı bulur ve proxy URL'sini oluşturur; istekleri ardından \u003Ccode>requests\u003C\u002Fcode> gönderir:\u003C\u002Fp>\u003Cpre>\u003Ccode>import requests\nfrom proxyhat import ProxyHat\nclient = ProxyHat(\n    api_key=\"your_api_key_here\"\n)\n# Proxy URL of an active sub-user (rotating residential)\nproxy_url = client.connection_url(country=\"us\")\n# Test the connection\nresponse = requests.get(\"https:\u002F\u002Fhttpbin.org\u002Fip\", proxies={\"http\": proxy_url, \"https\": proxy_url}, timeout=30)\nprint(response.json())\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch3>Raw Proxy Credentials with Requests\u003C\u002Fh3>\u003Cp>Eğer kullanmayı tercih ederseniz \u003Ccode>requests\u003C\u002Fcode> Doğrudan, proxy URL'sini yapılandırın:\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>Basit GET Proxy with a Proxy\u003C\u002Fh2>\u003Cp>İşte bir ProxyHat konutu aracılığıyla bir GET isteği gönderen tam bir örnek:\u003C\u002Fp>\u003Cpre>\u003Ccode>import requests\nfrom proxyhat import ProxyHat\nclient = ProxyHat(api_key=\"your_api_key_here\")\nproxy_url = client.connection_url(country=\"us\")\nproxies = {\"http\": proxy_url, \"https\": proxy_url}\n# Make a proxied GET request\nresponse = requests.get(\"https:\u002F\u002Fhttpbin.org\u002Fip\", proxies=proxies, timeout=30)\nprint(f\"Status: {response.status_code}\")\nprint(f\"IP: {response.json()['origin']}\")\nprint(f\"Headers: {response.headers}\")\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>Veya standart ile \u003Ccode>requests\u003C\u002Fcode> Kütüphane:\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>Doğru Proxy Type seçmek\u003C\u002Fh2>\u003Cp>ProxyHat üç proxy türü sunuyor. Kullanım durumunuza dayanarak seçin. Daha derin bir karşılaştırma için rehberimizi okuyun \u003Ca href=\"\u002Ftr\u002Fblog\u002Fresidential-vs-datacenter-vs-mobil-proxyler\">Konut vs datacenter vs mobil proxy\u003C\u002Fa>.\u003C\u002Fp>\u003Ctable>\n\u003Ccaption>Doğru Proxy Type seçmek\u003C\u002Fcaption>\u003Cthead>\u003Ctr>\u003Cth>Tipi Tipi Tipi Tipi\u003C\u002Fth>\u003Cth>En iyisi için\u003C\u002Fth>\u003Cth>Hız Hız Hız Hız\u003C\u002Fth>\u003Cth>Tespit Riski\u003C\u002Fth>\u003Cth>Maliyet Maliyet Maliyet Maliyet Maliyet\u003C\u002Fth>\u003C\u002Ftr>\u003C\u002Fthead>\u003Ctbody>\u003Ctr>\u003Ctd>Konut Konut Konut Konut\u003C\u002Ftd>\u003Ctd>Web scraping, SERP takip\u003C\u002Ftd>\u003Ctd>Medium Medium Medium Medium Medium\u003C\u002Ftd>\u003Ctd>Çok düşük\u003C\u002Ftd>\u003Ctd>Per GB\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Datacenter\u003C\u002Ftd>\u003Ctd>Yüksek hacimli, hız kritik görevler\u003C\u002Ftd>\u003Ctd>Hızlı Hızlı Hızlı Hızlı\u003C\u002Ftd>\u003Ctd>Daha yüksek\u003C\u002Ftd>\u003Ctd>IP \u002F ay\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Mobile Mobile Mobile\u003C\u002Ftd>\u003Ctd>Sosyal medya, uygulama testleri\u003C\u002Ftd>\u003Ctd>Medium Medium Medium Medium Medium\u003C\u002Ftd>\u003Ctd>En düşük\u003C\u002Ftd>\u003Ctd>Per GB\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Ch3>Proxy Tiplerini Kodlama\u003C\u002Fh3>\u003Cpre>\u003Ccode>import requests\nfrom proxyhat import ProxyHat\nclient = ProxyHat(api_key=\"your_api_key_here\")\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# 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)\n# Datacenter proxy: coming soon at ProxyHat\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>Bloking vs Sticky Sessions\u003C\u002Fh2>\u003Cp>Rotating proxy Her istek için yeni bir IP atamak, maksimum anonimliğe ihtiyacınız olan büyük ölçekli kazı için ideal. Sticky seansları Aynı IP'yi belirli bir süre için, giriş dizileri veya paginated navigasyon gibi çoklu adım akışları için tut.\u003C\u002Fp>\u003Ch3>Rotating Proxies (Yeni IP Her İstek)\u003C\u002Fh3>\u003Cpre>\u003Ccode>import requests\nfrom proxyhat import ProxyHat\nclient = ProxyHat(api_key=\"your_api_key_here\")\n# Rotating is the default: the gateway assigns a new IP per request\nproxy_url = client.connection_url(country=\"us\")\nproxies = {\"http\": proxy_url, \"https\": proxy_url}\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=proxies, 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 for Duration)\u003C\u002Fh3>\u003Cpre>\u003Ccode>import requests\nfrom proxyhat import ProxyHat\nclient = ProxyHat(api_key=\"your_api_key_here\")\n# Create a sticky session (sticky=True keeps the IP for 30 minutes)\nproxy_url = client.connection_url(country=\"us\", sticky=True)\nsession = requests.Session()\nsession.proxies = {\"http\": proxy_url, \"https\": proxy_url}\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 Requests\u003C\u002Fh2>\u003Cp>Belirli bir ülkeden veriye mi ihtiyacınız var? ProxyHat destek \u003Ca href=\"\u002Ftr\u002Flocations\">195+ lokasyonda geo-targeting\u003C\u002Fa>. Bu, yerelleştirilmiş SERP hurdalama, fiyat izleme ve içerik doğrulama için kritik.\u003C\u002Fp>\u003Cpre>\u003Ccode>import requests\nfrom proxyhat import ProxyHat\nclient = ProxyHat(api_key=\"your_api_key_here\")\n# Target a specific country\nproxy_url = client.connection_url(country=\"us\")\nresponse = requests.get(\n    \"https:\u002F\u002Fwww.google.com\u002Fsearch?q=best+restaurants\",\n    proxies={\"http\": proxy_url, \"https\": proxy_url},\n    timeout=30\n)\n# Target a specific city (a city always needs its region)\nproxy_url = client.connection_url(country=\"us\", region=\"new_york\", city=\"new_york\")\nresponse = requests.get(\n    \"https:\u002F\u002Fwww.google.com\u002Fsearch?q=best+restaurants\",\n    proxies={\"http\": proxy_url, \"https\": proxy_url},\n    timeout=30\n)\n# Using raw proxy URL with geo-targeting\n# Format: username-country-DE: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>Hata işleme ve Retries\u003C\u002Fh2>\u003Cp>Ağ talepleri başarısız olur. Proxies zamanout. Hedefler sizi bloke eder. Robust hatası, toy scripts'tan ayrı üretim hurdalarını işletir.\u003C\u002Fp>\u003Ch3>Temel Retry Mantık\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>requests ve urllib3 ile Otomatik Yeniden Deneme\u003C\u002Fh3>\u003Cpre>\u003Ccode>import requests\nfrom requests.adapters import HTTPAdapter\nfrom urllib3.util.retry import Retry\nfrom proxyhat import ProxyHat\nclient = ProxyHat(\n    api_key=\"your_api_key_here\"\n)\nproxy_url = client.connection_url(country=\"us\")\n# The SDK builds the proxy URL; retries come from urllib3\nsession = requests.Session()\nsession.mount(\"https:\u002F\u002F\", HTTPAdapter(max_retries=Retry(\n    total=3,\n    backoff_factor=1,\n    status_forcelist=[429, 500, 502, 503],\n)))\nsession.proxies = {\"http\": proxy_url, \"https\": proxy_url}\nresponse = session.get(\"https:\u002F\u002Fexample.com\u002Fdata\", timeout=30)\nprint(response.status_code)\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>Concurrent Hearing with Threading\u003C\u002Fh2>\u003Cp>Eşit istekler yavaştır. Üretim iş yükleri için Python'un kullanımını kullanın \u003Ccode>concurrent.futures\u003C\u002Fcode> İstekleri temsilciler aracılığıyla paralelleştirmek.\u003C\u002Fp>\u003Cpre>\u003Ccode>from concurrent.futures import ThreadPoolExecutor, as_completed\nimport requests\nfrom proxyhat import ProxyHat\nclient = ProxyHat(api_key=\"your_api_key_here\")\nproxy_url = client.connection_url(country=\"us\")  # rotating residential\nproxies = {\"http\": proxy_url, \"https\": proxy_url}\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>asyncio ve 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>Popüler Python Kütüphaneleri ile entegrasyon\u003C\u002Fh2>\u003Ch3>İsteklerle Kullanımı (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>httpx ile kullanım\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>Aiohttp ile kullanım\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>Yararlı ile kullanımı\u003C\u002Fh3>\u003Cp>Yararlı örümcekinize ProxyHat ekleyiniz \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>Üretim İpuçları\u003C\u002Fh2>\u003Ch3>Bağlantı Havuz ve Zamanlar\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>Logging ve İzleme\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>Çevre Credentials için Değişkenler\u003C\u002Fh3>\u003Cp>Hiçbir zaman zor kod kimlikleri. Çevre değişkenlerini kullanın:\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>Mevcut proxy planlarının ve trafik seçeneklerinin tam bir listesi için, ziyaret edin \u003Ca href=\"\u002Ftr\u002Fpricing\">Fiyat sayfası\u003C\u002Fa>Gelişmiş kullanım koşulları ve uç nokta referansı için, bakınız \u003Ca href=\"https:\u002F\u002Fdocs.proxyhat.com\u002F\" rel=\"noopener noreferrer\">API belgeleri\u003C\u002Fa>Ayrıca rehberimizi inceleyebilirsiniz \u003Ca href=\"\u002Ftr\u002Fblog\u002Fweb-scraping-icin-en-iyi-proxyler-2026\">Web için en iyi proxy 2026\u003C\u002Fa> Sağlayıcı karşılaştırmalar için.\u003C\u002Fp>\u003Cblockquote>\u003Ch3>Key Takeaways\u003C\u002Fh3>\u003Cul>\u003Cli>Bir komutta yükleme: \u003Ccode>pip install proxyhat requests\u003C\u002Fcode> Hemen başladın.\u003C\u002Fli>\u003Cli>SDK'yı basitleştirmek için kullanın: ProxyHat Python SDK, API anahtarınızdan proxy URL'sini oluşturur; rotasyonu ağ geçidi yapar.\u003C\u002Fli>\u003Cli>Doğru tip proxy seçin: Çekilme, hız için merkezi veriler, sosyal platformlar için mobil.\u003C\u002Fli>\u003Cli>Rotate vs çubuğu: Çok adımlı iş akışları için geri dönüşümlü proxy kullanın.\u003C\u002Fli>\u003Cli>İhtiyacınız olduğunda Geo-target: Yerelleştirilmiş veri toplama için ülke ve şehir.\u003C\u002Fli>\u003Cli>Hataları düzgün bir şekilde şarj edin: Üretim güvenilirliği için üst üste ve yeniden deneme mantığı uygulayın.\u003C\u002Fli>\u003Cli>Koncurrency ile Ölçek: Use Use Use Use Use Use \u003Ccode>ThreadPoolExecutor\u003C\u002Fcode> veya \u003Ccode>asyncio\u003C\u002Fcode> İstekleri paralelleştirmek için.\u003C\u002Fli>\u003Cli>Hiçbir zaman zor kod referansları: Mağaza API anahtarları çevre değişkenleri.\u003C\u002Fli>\u003C\u002Ful>\u003C\u002Fblockquote>","Python'da Proxy Kullanımı Rehberi","Python'da proxy kullanımını öğrenin. Requests kütüphanesi, ProxyHat SDK, hata yönetimi ve performans ipuçları ile adım adım rehber ve kod örnekleri.","\u002Ftr\u002Fblog\u002Fpython-ile-proxy-kullanimi",null,"Python'da Proxy Kullanımı","Python ile proxy kullanımı: Requests kütüphanesi, ProxyHat SDK, hata yönetimi ve performans optimizasyonu rehberi.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fpython-ile-proxy-kullanimi-og.webp",[19,22,25,28,31,34],{"question":20,"answer":21},"Python Requests ile proxy nasıl kullanılır?","requests.get() veya requests.post() çağrınıza proxy'nizi içeren bir proxies sözlüğü geçirin. HTTP ve HTTPS anahtarlarını proxy URL'nize ayarlayın, örneğin: proxies = {\"http\": \"http:\u002F\u002Fuser:pass@gate.proxyhat.com:8080\", \"https\": \"http:\u002F\u002Fuser:pass@gate.proxyhat.com:8080\"}.",{"question":23,"answer":24},"Python'da proxy rotasyonunu nasıl yaparım?","ProxyHat'in dönen proxy gateway'ini kullanın — aynı uç noktayı (gate.proxyhat.com:8080) kullanırsınız ve her istek otomatik olarak farklı bir IP alır. Manuel rotasyon gerekmez, gateway bunu otomatik olarak halleder.",{"question":26,"answer":27},"Python'da proxy hatalarını nasıl yönetirim?","requests.exceptions.ProxyError ve requests.exceptions.ConnectTimeout istisnalarını yakalamak için try\u002Fexcept blokları kullanın. Üstel geri çekilme ile yeniden deneme mantığı uygulayın ve başarısız proxy'lerden yeni bir IP'ye geçmeyi düşünün.",{"question":29,"answer":30},"Python'daki dönen ve yapışkanlar arasındaki fark nedir?","Rotating agents, büyük ölçekli kazı için ideal olan her istek için yeni bir IP adresi tayin eder. Stickyants aynı IP'yi belirli bir süre için koruyor (örneğin, 10-30 dakika), giriş seansları, alışveriş arabaları veya IP tutarlılık önemli olan paginated tarama için gereklidir.",{"question":32,"answer":33},"ProxyHat proxylerini asyncio ve aiohttp ile kullanabilir miyim?","Evet. ProxyHat proxy, proxy yapılandırmasını destekleyen herhangi bir HTTP müşteri ile çalışır, dahil \u003Ccode>aiohttp\u003C\u002Fcode>, \u003Ccode>httpx\u003C\u002Fcode> (async modu) ve \u003Ccode>asyncio\u003C\u002Fcode>- temelli çerçeveler. URL proxy'yi as the \u003Ccode>proxy\u003C\u002Fcode> Async müşterinizde parametre.",{"question":35,"answer":36},"Hangi Python kütüphanesi, referanslarla dolu web için en iyisidir?","Basit görevler için, \u003Ccode>requests\u003C\u002Fcode> ProxyHat SDK ile en kolay seçenektir. Yüksek hacimli için, kullanımı kullanın \u003Ccode>httpx\u003C\u002Fcode> veya \u003Ccode>aiohttp\u003C\u002Fcode>. Karmaşık tarama için aşağıdaki ve veri ekstraksiyonu ile, \u003Ccode>Scrapy\u003C\u002Fcode> Orta proxy ile en güçlü seçimdir. Tüm çalışmalar ProxyHat proxy ile sorunsuz bir şekilde çalışır.",[38,39,40,41,42],"Python'da proxy kullanmak, web scraping sırasında IP yasaklarını aşmak ve coğrafi kısıtlamaları atlamak için gereklidir.","ProxyHat SDK veya standart requests kütüphanesi ile proxy kimlik doğrulaması ve rotasyonu kolayca yapılabilir.","Konut, datacenter ve mobil proxy tipleri farklı hız, maliyet ve tespit riski avantajları sunar.","Çok adımlı işlemler için sticky sessions, büyük ölçekli kazı için ise rotating proxy kullanılmalıdır.","Üretim seviyesinde scraping için threading veya asyncio ile eşzamanlı istekler ve hata yönetimi kullanılmalıdır.",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\u002Fpython-ile-proxy-kullanimi-master.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fpython-ile-proxy-kullanimi-card.webp",12,{"name":51,"slug":52,"bio":53,"avatar_url":14,"website_url":14,"social_links":14},"ProxyHat Team","proxyhat-team","The ProxyHat editorial team covers proxies, web scraping, and data extraction.",[55],{"id":56,"slug":57,"name":58,"description":14,"meta_title":59,"meta_description":60,"parent_id":14},4,"gelistirici-rehberleri","Geliştirici Rehberleri","Geliştirici Rehberleri | ProxyHat Blog","Proxy entegrasyonu için kod eğitimleri ve SDK rehberleri.",[62,66,70],{"id":63,"slug":64,"name":65},1,"web-scraping","Web Scraping",{"id":67,"slug":68,"name":69},9,"python","Python",{"id":49,"slug":71,"name":72},"sdk","SDK",{"en":74,"x-default":74},"\u002Fblog\u002Fusing-proxies-in-python",{"ko":76,"fr":77,"tr":13,"es":78,"de":79,"it":80,"pl":81,"en":74,"ru":82,"ja":83,"zh":84,"pt":85},"\u002Fko\u002Fblog\u002Fpython-proxy-sayongbeop","\u002Ffr\u002Fblog\u002Futiliser-des-proxies-en-python","\u002Fes\u002Fblog\u002Fusar-proxies-en-python","\u002Fde\u002Fblog\u002Fproxies-in-python-verwenden","\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,[88,116,143,160],{"id":89,"slug":90,"title":91,"excerpt":92,"featured_image_url":93,"featured_image_alt":94,"card_image_url":95,"og_image_url":96,"published_at":97,"updated_at":98,"content_updated_at":99,"reading_time_minutes":100,"is_featured":43,"indexable":4,"views":101,"author":102,"categories":103,"tags":105},210,"ai-ajanlari-icin-proxy-kurulumu","AI Ajanları için Proxy Kurulumu: browser-use, Crawl4AI ve MCP","Bulut VM'lerindeki ajanlar internete datacenter IP'lerinden çıkar. browser-use, Crawl4AI ve bir MCP sunucusu için güncel, çalışan proxy yapılandırmalarını; sticky ve rotasyon için bir karar tablosunu ve kaçınılması gereken maliyet tuzaklarını derledik.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Ftr\u002Fai-ajanlari-icin-proxy-kurulumu-master.webp","Proxy Setup for AI Agents: browser-use, Crawl4AI and an MCP Server","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Ftr\u002Fai-ajanlari-icin-proxy-kurulumu-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Ftr\u002Fai-ajanlari-icin-proxy-kurulumu-og.webp","2026-10-24T09:00:00+00:00","2026-10-24T09:00:20+00:00","2026-10-03T09:41:40+00:00",14,31,{"name":51,"slug":52,"bio":53,"avatar_url":14,"website_url":14,"social_links":14},[104],{"id":56,"slug":57,"name":58,"description":14,"meta_title":59,"meta_description":60,"parent_id":14},[106,107,111,112],{"id":63,"slug":64,"name":65},{"id":108,"slug":109,"name":110},2,"residential-proxy","Residential Proxy",{"id":67,"slug":68,"name":69},{"id":113,"slug":114,"name":115},22,"playwright","Playwright",{"id":117,"slug":118,"title":119,"excerpt":120,"featured_image_url":121,"featured_image_alt":122,"card_image_url":123,"og_image_url":124,"published_at":125,"updated_at":126,"content_updated_at":99,"reading_time_minutes":100,"is_featured":43,"indexable":4,"views":127,"author":128,"categories":129,"tags":131},206,"camoufox-residential-proxy-python-rehberi","Camoufox ve Residential Proxy: Kod Odaklı Python Rehberi","C++ düzeyinde yamalanmış Firefox olan Camoufox'u residential proxy arkasında çalıştırma: güncel Python API'si, geoip'in neden sabit oturum gerektirdiği, parmak izi tutarlılık listesi ve Patchright ya da nodriver'ın ne zaman daha uygun olduğu.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Ftr\u002Fcamoufox-residential-proxy-python-rehberi-master.webp","Camoufox with Residential Proxies: A Code-First Python Guide","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Ftr\u002Fcamoufox-residential-proxy-python-rehberi-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Ftr\u002Fcamoufox-residential-proxy-python-rehberi-og.webp","2026-10-13T09:00:00+00:00","2026-10-13T09:00:22+00:00",44,{"name":51,"slug":52,"bio":53,"avatar_url":14,"website_url":14,"social_links":14},[130],{"id":56,"slug":57,"name":58,"description":14,"meta_title":59,"meta_description":60,"parent_id":14},[132,133,137,141,142],{"id":63,"slug":64,"name":65},{"id":134,"slug":135,"name":136},6,"anti-tespit","Anti-Tespit",{"id":138,"slug":139,"name":140},21,"headless-tarayici","Headless Tarayıcı",{"id":67,"slug":68,"name":69},{"id":108,"slug":109,"name":110},{"id":144,"slug":145,"title":146,"excerpt":147,"featured_image_url":148,"featured_image_alt":14,"card_image_url":149,"og_image_url":150,"published_at":151,"updated_at":45,"content_updated_at":152,"reading_time_minutes":49,"is_featured":43,"indexable":43,"views":153,"author":154,"categories":155,"tags":157},50,"guvenilir-scraping-mimarisi-tasarlama","Güvenilir Bir Scraping Mimarisi Tasarlama","Bir end-to-end scraping sistemi tasarlayın: programcı, URL kuyruğu, tarama havuzu, proxy katmanı, ., depolama ve izleme. mimarlık diyagramları ile üretim-okuy Python kodu.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fguvenilir-scraping-mimarisi-tasarlama-master.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fguvenilir-scraping-mimarisi-tasarlama-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fguvenilir-scraping-mimarisi-tasarlama-og.webp","2026-02-24T06:55:16+00:00","2026-10-03T08:21:36+00:00",68,{"name":51,"slug":52,"bio":53,"avatar_url":14,"website_url":14,"social_links":14},[156],{"id":56,"slug":57,"name":58,"description":14,"meta_title":59,"meta_description":60,"parent_id":14},[158,159],{"id":49,"slug":71,"name":72},{"id":63,"slug":64,"name":65},{"id":161,"slug":162,"title":163,"excerpt":164,"featured_image_url":165,"featured_image_alt":14,"card_image_url":166,"og_image_url":167,"published_at":168,"updated_at":45,"content_updated_at":169,"reading_time_minutes":170,"is_featured":43,"indexable":43,"views":171,"author":172,"categories":173,"tags":175},41,"proxy-performansini-izleme","Proxy Performansını İzleme: Gecikme, Başarı Oranı ve Uyarılar","Aracın, monitörün ve proxy performansına nasıl uyarılacağını öğrenin - yüzde geç saatler, başarı oranları, hata modelleri ve bant genişliği takip edin. Python, Node.js ve Go'daki kod örnekleri.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fproxy-performansini-izleme-master.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fproxy-performansini-izleme-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fproxy-performansini-izleme-og.webp","2026-02-15T00:39:23+00:00","2026-10-03T08:21:21+00:00",11,75,{"name":51,"slug":52,"bio":53,"avatar_url":14,"website_url":14,"social_links":14},[174],{"id":56,"slug":57,"name":58,"description":14,"meta_title":59,"meta_description":60,"parent_id":14},[176,177],{"id":49,"slug":71,"name":72},{"id":63,"slug":64,"name":65},[]]