import requests

# List of proxies
proxy_list = [
    'proxy1.example.com:8000',
    'proxy2.example.com:8000',
    'proxy3.example.com:8000',
    # Add more proxies as needed
]

# Function to rotate proxies
def get_proxy():
    global proxy_list
    proxy = proxy_list.pop(0)
    proxy_list.append(proxy)
    return {'http': 'http://' + proxy, 'https': 'https://' + proxy}

# Function to make a request using rotated proxy
def make_request(url):
    try:
        proxy = get_proxy()
        response = requests.get(url, proxies=proxy)
        if response.status_code == 200:
            return response.text
        else:
            print(f"Request failed with status code: {response.status_code}")
            return None
    except Exception as e:
        print(f"An error occurred: {str(e)}")
        return None

# Example usage
if __name__ == "__main__":
    target_url = 'http://example.com'
    for _ in range(10):  # Make 10 requests
        response = make_request(target_url)
        if response:
            print(response)
        else:
            print("Request failed.")

이 스크립트는 프록시 목록을 정의하고 각 요청에 대해 프록시를 순환하는 기능을 제공합니다. 요구 사항에 따라 프록시 목록과 대상 URL을 조정할 수 있습니다. 꼭 교체하세요 'http://example.com' 요청을 보내려는 URL을 사용하세요.

댓글 (0)

여기에는 아직 댓글이 없습니다. 첫 번째 댓글이 되실 수 있습니다!

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다


프록시 선택 및 구매

데이터센터 프록시

회전 프록시

UDP 프록시

전 세계 10,000명 이상의 고객이 신뢰함

대리 고객
대리 고객
대리 고객 flowch.ai
대리 고객
대리 고객
대리 고객