[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"blog-post-ko-python-proxy-sayongbeop":3},{"success":4,"payload":5,"related":80,"errors":170},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":31,"allow_index":36,"noindex_google_only":36,"allow_follow":4,"published_at":37,"updated_at":38,"content_updated_at":39,"featured_image_url":40,"featured_image_alt":14,"card_image_url":41,"reading_time_minutes":42,"author":43,"categories":47,"tags":54,"alternates":66,"locale_paths":68,"views":79},3,"python-proxy-sayongbeop","Python에서 프록시 사용하기 (Requests + ProxyHat SDK)","Python에서 프록시를 사용하는 방법을 알아봅니다. requests 라이브러리와 ProxyHat SDK를 활용한 예제, IP 로테이션, 오류 처리, 비동기 스크래핑 패턴을 다룹니다.","\u003Ch2>Python에서 프록시가 필요한 이유\u003C\u002Fh2>\n\u003Cp>Python은 웹 스크래핑에 가장 인기 있는 언어입니다. requests, BeautifulSoup, Scrapy와 같은 라이브러리로 쉽게 시작할 수 있습니다. 하지만 프록시 없이 대규모 스크래핑을 시도하면 대상 사이트가 IP를 빠르게 차단합니다.\u003C\u002Fp>\n\u003Cp>이 가이드에서는 Python에서 프록시를 설정하고 사용하는 모든 방법을 다룹니다 — 기본 requests 설정부터 \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FProxyHatCom\u002Fpython-sdk\" rel=\"noopener noreferrer\">ProxyHat SDK\u003C\u002Fa>를 활용한 자동 로테이션까지.\u003C\u002Fp>\n\u003Ch2>기본 프록시 설정: requests 라이브러리\u003C\u002Fh2>\n\u003Cp>Python의 requests 라이브러리는 프록시를 기본적으로 지원합니다. \u003Ccode>proxies\u003C\u002Fcode> 매개변수에 딕셔너리를 전달하면 됩니다:\u003C\u002Fp>\n\u003Cpre>\u003Ccode>import requests\n\nproxies = {\n    \"http\": \"http:\u002F\u002Fuser-sid-s1:pass@gate.proxyhat.com:8080\",\n    \"https\": \"http:\u002F\u002Fuser-sid-s1:pass@gate.proxyhat.com:8080\",\n}\n\nresponse = requests.get(\"https:\u002F\u002Fexample.com\", proxies=proxies, timeout=30)\nprint(response.status_code)\nprint(response.text[:500])\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch3>SOCKS5 프록시 사용\u003C\u002Fh3>\n\u003Cp>SOCKS5 프록시를 사용하려면 \u003Ccode>requests[socks]\u003C\u002Fcode> 패키지를 설치해야 합니다:\u003C\u002Fp>\n\u003Cpre>\u003Ccode>pip install requests[socks]\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cpre>\u003Ccode>import requests\n\nproxies = {\n    \"http\": \"socks5:\u002F\u002Fuser:pass@gate.proxyhat.com:1080\",\n    \"https\": \"socks5:\u002F\u002Fuser:pass@gate.proxyhat.com:1080\",\n}\n\nresponse = requests.get(\"https:\u002F\u002Fexample.com\", proxies=proxies)\nprint(response.status_code)\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch2>ProxyHat Python SDK\u003C\u002Fh2>\n\u003Cp>\u003Ca href=\"https:\u002F\u002Fgithub.com\u002FProxyHatCom\u002Fpython-sdk\" rel=\"noopener noreferrer\">ProxyHat Python SDK\u003C\u002Fa>는 API 키로 서브유저 자격 증명을 조회해 바로 쓸 수 있는 프록시 URL을 만들어 줍니다. 요청은 \u003Ccode>requests\u003C\u002Fcode> 같은 HTTP 클라이언트로 보냅니다:\u003C\u002Fp>\n\u003Cpre>\u003Ccode>import requests\nfrom proxyhat import ProxyHat\n\nclient = ProxyHat(api_key=\"your_api_key\")\n\n# 로테이팅 레지덴셜 프록시 - 요청마다 새 IP\nproxy = client.connection_url(country=\"us\")\nresponse = requests.get(\"https:\u002F\u002Fexample.com\u002Fproducts\", proxies={\"http\": proxy, \"https\": proxy}, timeout=30)\nprint(response.status_code)\nprint(response.text[:500])\n\n# 스티키 세션 - 여러 요청에 동일한 IP 유지 (10분)\nsticky = client.connection_url(country=\"us\", sticky=\"10m\")\nsession = requests.Session()\nsession.proxies = {\"http\": sticky, \"https\": sticky}\npage1 = session.get(\"https:\u002F\u002Fexample.com\u002Flogin\")\npage2 = session.post(\"https:\u002F\u002Fexample.com\u002Flogin\", data={\"user\": \"test\"})\npage3 = session.get(\"https:\u002F\u002Fexample.com\u002Fdashboard\")\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch2>프록시 로테이션 구현\u003C\u002Fh2>\n\u003Cp>프록시 로테이션은 여러 IP를 순환하여 차단을 방지합니다. 다음은 직접 구현하는 방법입니다:\u003C\u002Fp>\n\u003Cpre>\u003Ccode>import requests\nimport random\n\nproxy_list = [\n    \"http:\u002F\u002Fuser-sid-s1:pass@gate.proxyhat.com:8080\",\n    \"http:\u002F\u002Fuser-sid-s2:pass@gate.proxyhat.com:8080\",\n    \"http:\u002F\u002Fuser-sid-s3:pass@gate.proxyhat.com:8080\",\n]\n\ndef get_random_proxy():\n    proxy = random.choice(proxy_list)\n    return {\"http\": proxy, \"https\": proxy}\n\ndef scrape_with_rotation(url, max_retries=3):\n    for attempt in range(max_retries):\n        try:\n            proxy = get_random_proxy()\n            response = requests.get(url, proxies=proxy, timeout=30)\n            if response.status_code == 200:\n                return response\n        except requests.exceptions.RequestException:\n            continue\n    return None\n\n# 사용 예\nresult = scrape_with_rotation(\"https:\u002F\u002Fexample.com\u002Fproducts\")\nif result:\n    print(result.text[:500])\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch2>오류 처리 및 재시도 로직\u003C\u002Fh2>\n\u003Cp>프록시를 사용한 스크래핑에서는 연결 실패, 타임아웃, 차단이 일반적입니다. 견고한 오류 처리가 필수적입니다:\u003C\u002Fp>\n\u003Cpre>\u003Ccode>import requests\nfrom requests.exceptions import ProxyError, ConnectTimeout, ConnectionError\nimport time\n\ndef robust_scrape(url, proxies, max_retries=3, backoff_factor=2):\n    for attempt in range(max_retries):\n        try:\n            response = requests.get(url, proxies=proxies, timeout=30)\n            if response.status_code == 200:\n                return response\n            elif response.status_code == 403:\n                print(f\"차단됨 (시도 {attempt + 1}), 재시도 중...\")\n                time.sleep(backoff_factor ** attempt)\n            elif response.status_code == 429:\n                print(f\"속도 제한 (시도 {attempt + 1}), 대기 중...\")\n                time.sleep(backoff_factor ** (attempt + 1))\n        except (ProxyError, ConnectTimeout, ConnectionError) as e:\n            print(f\"연결 오류 (시도 {attempt + 1}): {e}\")\n            time.sleep(backoff_factor ** attempt)\n    return None\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch2>비동기 스크래핑\u003C\u002Fh2>\n\u003Cp>대량 스크래핑의 경우 비동기 요청이 동기 요청보다 훨씬 빠릅니다. \u003Ccode>aiohttp\u003C\u002Fcode>를 사용한 비동기 프록시 스크래핑:\u003C\u002Fp>\n\u003Cpre>\u003Ccode>import aiohttp\nimport asyncio\n\nasync def fetch(session, url, proxy):\n    try:\n        async with session.get(url, proxy=proxy, timeout=aiohttp.ClientTimeout(total=30)) as response:\n            return await response.text()\n    except Exception as e:\n        print(f\"오류: {e}\")\n        return None\n\nasync def scrape_urls(urls, proxy_url):\n    async with aiohttp.ClientSession() as session:\n        tasks = [fetch(session, url, proxy_url) for url in urls]\n        return await asyncio.gather(*tasks)\n\n# 사용 예\nurls = [f\"https:\u002F\u002Fexample.com\u002Fproduct\u002F{i}\" for i in range(1, 101)]\nproxy = \"http:\u002F\u002Fuser-sid-s1:pass@gate.proxyhat.com:8080\"\nresults = asyncio.run(scrape_urls(urls, proxy))\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch2>Scrapy와 프록시\u003C\u002Fh2>\n\u003Cp>Scrapy 프레임워크에서 프록시를 사용하는 방법:\u003C\u002Fp>\n\u003Cpre>\u003Ccode># settings.py에 추가\nDOWNLOADER_MIDDLEWARES = {\n    'scrapy.downloadermiddlewares.httpproxy.HttpProxyMiddleware': 110,\n}\n\n# 미들웨어에서 프록시 설정\nclass ProxyMiddleware:\n    def process_request(self, request, spider):\n        request.meta['proxy'] = \"http:\u002F\u002Fuser-sid-s1:pass@gate.proxyhat.com:8080\"\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch2>모범 사례\u003C\u002Fh2>\n\u003Cp>Python에서 프록시를 사용한 스크래핑의 모범 사례입니다:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Cstrong>타임아웃 설정\u003C\u002Fstrong> — 모든 요청에 타임아웃을 설정하여 무한 대기를 방지하십시오. 30초가 좋은 기본값입니다.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>재시도 로직\u003C\u002Fstrong> — 지수 백오프로 재시도하여 서버에 과부하를 주지 마십시오.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>User-Agent 로테이션\u003C\u002Fstrong> — 프록시 로테이션과 함께 User-Agent 문자열도 로테이션하십시오.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>세션 관리\u003C\u002Fstrong> — 쿠키가 필요한 사이트에는 requests.Session을 사용하십시오.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>속도 제한 준수\u003C\u002Fstrong> — 요청 사이에 적절한 지연을 두어 대상 사이트에 부담을 주지 마십시오.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>Python 스크래핑을 시작하시겠습니까? \u003Ca href=\"\u002Fko\u002Fpricing\">ProxyHat 요금제\u003C\u002Fa>를 확인하고 \u003Ca href=\"https:\u002F\u002Fdocs.proxyhat.com\u002F\" rel=\"noopener noreferrer\">API 문서\u003C\u002Fa>로 5분 이내에 첫 프록시 요청을 보내보십시오.\u003C\u002Fp>","Python에서 프록시 사용하기 가이드","Python에서 프록시를 사용하는 완벽한 실전 가이드입니다. requests 라이브러리, ProxyHat SDK, 자동 IP 로테이션, aiohttp 비동기 스크래핑 패턴의 코드 예제를 단계별로 제공하며 인증 설정부터 대규모 스크래핑까지 전 과정을 안내합니다.","\u002Fko\u002Fblog\u002Fpython-proxy-sayongbeop",null,"Python에서 프록시 사용하기","Python에서 프록시 설정 방법. requests, ProxyHat SDK, 로테이션, 비동기 스크래핑 예제.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fpython-proxy-sayongbeop-og.webp",[19,22,25,28],{"question":20,"answer":21},"Python에서 프록시를 어떻게 설정합니까?","Python requests 라이브러리에서 proxies 매개변수에 딕셔너리를 전달하면 됩니다. HTTP와 HTTPS 프록시 URL을 지정하면 됩니다. ProxyHat SDK를 사용하면 api_key만 설정하면 자동으로 프록시가 처리됩니다.",{"question":23,"answer":24},"Python에서 프록시 로테이션은 어떻게 합니까?","각 요청마다 다른 프록시를 할당하면 됩니다. ProxyHat SDK는 자동 로테이션을 기본 지원합니다. 직접 구현하려면 프록시 목록에서 무작위로 선택하거나 라운드 로빈 방식을 사용할 수 있습니다.",{"question":26,"answer":27},"Python으로 프록시를 사용한 비동기 스크래핑이 가능합니까?","네, aiohttp나 httpx 같은 비동기 HTTP 클라이언트와 함께 프록시를 사용할 수 있습니다. 비동기 스크래핑은 동시에 수백 개의 요청을 처리하여 처리량을 크게 향상시킵니다.",{"question":29,"answer":30},"Python 프록시 연결 오류를 어떻게 처리합니까?","try-except 블록으로 ConnectionError, Timeout, ProxyError를 캐치하고 재시도 로직을 구현하십시오. 지수 백오프로 재시도하고 실패 시 다른 프록시로 전환하는 것이 모범 사례입니다.",[32,33,34,35],"Python requests 라이브러리는 proxies 매개변수로 HTTP\u002FSOCKS5 프록시를 쉽게 설정할 수 있습니다.","ProxyHat SDK를 활용하면 자동 IP 로테이션과 스티키 세션 관리를 간소화할 수 있습니다.","대규모 스크래핑에는 aiohttp를 사용한 비동기 요청이 처리량을 크게 향상시킵니다.","프로덕션 스크래핑을 위해서는 지수 백오프 재시도와 타임아웃 설정 등 오류 처리가 필수입니다.",false,"2026-01-05T10:53:19+00:00","2026-07-19T03:13:07+00:00","2026-11-17T10:13:54+00:00","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fpython-proxy-sayongbeop-master.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fpython-proxy-sayongbeop-card.webp",12,{"name":44,"slug":45,"bio":46,"avatar_url":14,"website_url":14,"social_links":14},"ProxyHat Team","proxyhat-team","The ProxyHat editorial team covers proxies, web scraping, and data extraction.",[48],{"id":49,"slug":50,"name":51,"description":14,"meta_title":52,"meta_description":53,"parent_id":14},4,"gaebaljja-gaideu","개발자 가이드","개발자 가이드 | ProxyHat 블로그","프록시를 애플리케이션에 통합하기 위한 코드 튜토리얼 및 SDK 가이드.",[55,59,63],{"id":56,"slug":57,"name":58},1,"web-scraping","웹 스크래핑",{"id":60,"slug":61,"name":62},9,"python","Python",{"id":42,"slug":64,"name":65},"sdk","SDK",{"en":67,"x-default":67},"\u002Fblog\u002Fusing-proxies-in-python",{"ko":13,"fr":69,"tr":70,"es":71,"de":72,"it":73,"pl":74,"en":67,"ru":75,"ja":76,"zh":77,"pt":78},"\u002Ffr\u002Fblog\u002Futiliser-des-proxies-en-python","\u002Ftr\u002Fblog\u002Fpython-ile-proxy-kullanimi","\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,[81,109,136,153],{"id":82,"slug":83,"title":84,"excerpt":85,"featured_image_url":86,"featured_image_alt":87,"card_image_url":88,"og_image_url":89,"published_at":90,"updated_at":91,"content_updated_at":92,"reading_time_minutes":93,"is_featured":36,"indexable":4,"views":94,"author":95,"categories":96,"tags":98},210,"ai-agent-proxy-seoljeong","AI 에이전트 프록시 설정: browser-use·Crawl4AI·MCP","클라우드 VM의 에이전트는 데이터센터 IP로 접속합니다. browser-use, Crawl4AI, MCP 서버에서 지금 작동하는 프록시 설정을 sticky와 로테이션 선택 표, 피해야 할 비용 함정과 함께 정리했습니다.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fko\u002Fai-agent-proxy-seoljeong-master.webp","Proxy Setup for AI Agents: browser-use, Crawl4AI and an MCP Server","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fko\u002Fai-agent-proxy-seoljeong-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fko\u002Fai-agent-proxy-seoljeong-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":44,"slug":45,"bio":46,"avatar_url":14,"website_url":14,"social_links":14},[97],{"id":49,"slug":50,"name":51,"description":14,"meta_title":52,"meta_description":53,"parent_id":14},[99,100,104,105],{"id":56,"slug":57,"name":58},{"id":101,"slug":102,"name":103},2,"residential-proxies","주거용 프록시",{"id":60,"slug":61,"name":62},{"id":106,"slug":107,"name":108},22,"playwright","Playwright",{"id":110,"slug":111,"title":112,"excerpt":113,"featured_image_url":114,"featured_image_alt":115,"card_image_url":116,"og_image_url":117,"published_at":118,"updated_at":119,"content_updated_at":92,"reading_time_minutes":93,"is_featured":36,"indexable":4,"views":120,"author":121,"categories":122,"tags":124},206,"camoufox-residential-proxy-python-gaideu","Camoufox와 레지덴셜 프록시: 코드로 보는 Python 가이드","C++ 레벨에서 패치한 Firefox인 Camoufox를 레지덴셜 프록시 뒤에서 돌리는 방법. 최신 Python API, geoip에 스티키 세션이 필요한 이유, 핑거프린트 일관성 체크리스트, 그리고 Patchright나 nodriver가 더 맞는 경우를 정리했습니다.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fko\u002Fcamoufox-residential-proxy-python-gaideu-master.webp","Camoufox with Residential Proxies: A Code-First Python Guide","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fko\u002Fcamoufox-residential-proxy-python-gaideu-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fko\u002Fcamoufox-residential-proxy-python-gaideu-og.webp","2026-10-13T09:00:00+00:00","2026-10-13T09:00:22+00:00",45,{"name":44,"slug":45,"bio":46,"avatar_url":14,"website_url":14,"social_links":14},[123],{"id":49,"slug":50,"name":51,"description":14,"meta_title":52,"meta_description":53,"parent_id":14},[125,126,130,134,135],{"id":56,"slug":57,"name":58},{"id":127,"slug":128,"name":129},6,"anti-detection","안티 탐지",{"id":131,"slug":132,"name":133},21,"headless-browser","헤드리스 브라우저",{"id":60,"slug":61,"name":62},{"id":101,"slug":102,"name":103},{"id":137,"slug":138,"title":139,"excerpt":140,"featured_image_url":141,"featured_image_alt":14,"card_image_url":142,"og_image_url":143,"published_at":144,"updated_at":38,"content_updated_at":145,"reading_time_minutes":42,"is_featured":36,"indexable":36,"views":146,"author":147,"categories":148,"tags":150},50,"anjeongjeok-scraping-akitecheo","안정적인 스크래핑 아키텍처 설계","안정적이고 확장 가능한 스크래핑 아키텍처를 설계하는 방법. 내결함성, 데이터 일관성, 모니터링, 확장성을 갖춘 프로덕션급 시스템 구축을 다룹니다.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fanjeongjeok-scraping-akitecheo-master.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fanjeongjeok-scraping-akitecheo-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fanjeongjeok-scraping-akitecheo-og.webp","2026-02-24T06:55:16+00:00","2026-02-26T00:44:30+00:00",68,{"name":44,"slug":45,"bio":46,"avatar_url":14,"website_url":14,"social_links":14},[149],{"id":49,"slug":50,"name":51,"description":14,"meta_title":52,"meta_description":53,"parent_id":14},[151,152],{"id":42,"slug":64,"name":65},{"id":56,"slug":57,"name":58},{"id":154,"slug":155,"title":156,"excerpt":157,"featured_image_url":158,"featured_image_alt":14,"card_image_url":159,"og_image_url":160,"published_at":161,"updated_at":38,"content_updated_at":145,"reading_time_minutes":162,"is_featured":36,"indexable":36,"views":163,"author":164,"categories":165,"tags":167},41,"proxy-seongneung-monitoring","프록시 성능 모니터링: 지연 시간, 성공률, 알림","프록시 성능을 모니터링하는 방법. 지연 시간, 성공률, 대역폭 사용량 추적, 알림 설정, 대시보드 구축을 코드 예제와 함께 설명합니다.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fproxy-seongneung-monitoring-master.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fproxy-seongneung-monitoring-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fproxy-seongneung-monitoring-og.webp","2026-02-15T00:39:23+00:00",11,75,{"name":44,"slug":45,"bio":46,"avatar_url":14,"website_url":14,"social_links":14},[166],{"id":49,"slug":50,"name":51,"description":14,"meta_title":52,"meta_description":53,"parent_id":14},[168,169],{"id":42,"slug":64,"name":65},{"id":56,"slug":57,"name":58},[]]