[Python] Can't send requests to https urls with apify proxy

Discussão em 'Python' iniciado por Stack, Janeiro 28, 2025.

  1. Stack

    Stack Membro Participativo

    This is my first time subscribing to a proxy provider and I went with Apify Creator Plan.

    My problem is on testing, I can only send requests to http urls, it works until I change to https then it doesn't. Here's a snippet:

    import requests
    import dotenv

    password = dotenv.get_key('.env', 'APIFY_PROXY_PASSWORD')
    group = 'auto'
    proxy_url = f"http://groups-{group}:{password}@proxy.apify.com:8000"
    proxy_handler = {
    "http": proxy_url,
    "https": proxy_url,
    }

    r = requests.get('http://httpbin.org/ip', proxies=proxies, timeout=5)
    print(r)
    print(r.json())


    Once I change it to https://httpbin.org/ip I get a proxy Error: requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='httpbin.org', port=443): Read timed out. (read timeout=5)

    I've seen a lot of similar question about http proxy "tunneling" & that they send a CONNECT request, but none actually helped me understand why this happens with https only or solve my issue.

    Continue reading...

Compartilhe esta Página