[Python] Why does it take a long time to receive requests when using a local proxy in python?

Discussão em 'Python' iniciado por Stack, Dezembro 1, 2024.

  1. Stack

    Stack Membro Participativo

    I am using a local proxy to intercept HTTPS traffic in my Python script, but I'm experiencing significant delays when making requests. the requests take a long time to complete when routed through my local proxy, and the delay seems to occur during the TCP handshake.

    Here's the code I'm using:

    import requests

    proxies = {
    "http": "http://127.0.0.1:8085",
    "https": "http://127.0.0.1:8085"}

    url = 'https://google.com'

    response = requests.get(url, proxies=proxies, verify=False)
    print(response)


    A simple request to google that goes through a local proxy I'm running on my machine. The request took 21 seconds

    What I've tried:

    1. Changing the proxy software (used mitmproxy and then fiddler)
    2. Changing the ports
    3. Testing on different urls
    4. Changing the verify parameter, True and False
    5. Sending the request directly from the proxy software

    The delay seems to be in the proxy itself, not just from the python code.

    What I want to know:

    1. Why does the local proxy introduce such a significant delay in the requests?
    2. Is there something wrong with my proxy configuration or Python code?

    Continue reading...

Compartilhe esta Página