1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Rotating proxies with REQUESTS module in Python

Discussão em 'Python' iniciado por Stack, Outubro 4, 2024 às 02:52.

  1. Stack

    Stack Membro Participativo

    Hey everyone I'm aware that this is a fairly simple problem but I've been unable to find a fix and I'm really struggling. I've coded/reworked an Ebay bot that I had found open source code on github. I've included proxies for the bot as this is how the views will appear as real but yet I'm struggling to rotate through the proxies so it's 1 GET request = 1 proxy server usage.

    Below is the code that I've been struggling with to make it work and an image of the terminal output. The code works but just not as intended with the proxies

    with open("validproxylist.txt", "r") as f:
    for line in f:
    proxies = f.read().split("\n")

    counter = 0

    for i in range(number_of_views):
    print(f"Using proxy {proxies[counter]}")
    r = requests.get(link, headers=headers, proxies= {
    "https" : proxies[counter],
    "http" : proxies[counter],
    })


    Output from terminal only showing the usage of 1 proxy server:

    [​IMG]

    I've watched a few videos on YouTube that explain how rotating proxies work with the REQUESTS module but I've been unable to find a fix with user input being included. I have also searched Stack Overflow but can only find the problem of using 1 proxy and not multiple.

    Continue reading...

Compartilhe esta Página